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

Side by Side Diff: chromecast/browser/cast_content_browser_client.cc

Issue 1814263002: [chromecast] Start deprecating MediaMessageLoop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fixed weak_ptr deref issue Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CastContentBrowserClient::GetCmaMediaPipelineClient() { 110 CastContentBrowserClient::GetCmaMediaPipelineClient() {
111 if (!cma_media_pipeline_client_.get()) 111 if (!cma_media_pipeline_client_.get())
112 cma_media_pipeline_client_ = CreateCmaMediaPipelineClient(); 112 cma_media_pipeline_client_ = CreateCmaMediaPipelineClient();
113 return cma_media_pipeline_client_; 113 return cma_media_pipeline_client_;
114 } 114 }
115 #endif // OS_ANDROID 115 #endif // OS_ANDROID
116 116
117 void CastContentBrowserClient::ProcessExiting() { 117 void CastContentBrowserClient::ProcessExiting() {
118 // Finalize CastMediaShlib on media thread to ensure it's not accessed 118 // Finalize CastMediaShlib on media thread to ensure it's not accessed
119 // after Finalize. 119 // after Finalize.
120 media::MediaMessageLoop::GetTaskRunner()->PostTask( 120 GetMediaTaskRunner()->PostTask(FROM_HERE,
121 FROM_HERE, base::Bind(&media::CastMediaShlib::Finalize)); 121 base::Bind(&media::CastMediaShlib::Finalize));
122 } 122 }
123 123
124 void CastContentBrowserClient::SetMetricsClientId( 124 void CastContentBrowserClient::SetMetricsClientId(
125 const std::string& client_id) { 125 const std::string& client_id) {
126 } 126 }
127 127
128 void CastContentBrowserClient::RegisterMetricsProviders( 128 void CastContentBrowserClient::RegisterMetricsProviders(
129 ::metrics::MetricsService* metrics_service) { 129 ::metrics::MetricsService* metrics_service) {
130 } 130 }
131 131
132 bool CastContentBrowserClient::EnableRemoteDebuggingImmediately() { 132 bool CastContentBrowserClient::EnableRemoteDebuggingImmediately() {
133 return true; 133 return true;
134 } 134 }
135 135
136 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( 136 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts(
137 const content::MainFunctionParams& parameters) { 137 const content::MainFunctionParams& parameters) {
138 content::BrowserMainParts* parts = 138 content::BrowserMainParts* parts =
139 new CastBrowserMainParts(parameters, url_request_context_factory_.get()); 139 new CastBrowserMainParts(parameters, url_request_context_factory_.get());
140 CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this); 140 CastBrowserProcess::GetInstance()->SetCastContentBrowserClient(this);
141 return parts; 141 return parts;
142 } 142 }
143 143
144 void CastContentBrowserClient::RenderProcessWillLaunch( 144 void CastContentBrowserClient::RenderProcessWillLaunch(
145 content::RenderProcessHost* host) { 145 content::RenderProcessHost* host) {
146 #if !defined(OS_ANDROID) 146 #if !defined(OS_ANDROID)
147 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter( 147 scoped_refptr<media::CmaMessageFilterHost> cma_message_filter(
148 new media::CmaMessageFilterHost(host->GetID(), 148 new media::CmaMessageFilterHost(
149 GetCmaMediaPipelineClient())); 149 host->GetID(), GetCmaMediaPipelineClient(), GetMediaTaskRunner()));
150 host->AddFilter(cma_message_filter.get()); 150 host->AddFilter(cma_message_filter.get());
151 #endif // !defined(OS_ANDROID) 151 #endif // !defined(OS_ANDROID)
152 152
153 // Forcibly trigger I/O-thread URLRequestContext initialization before 153 // Forcibly trigger I/O-thread URLRequestContext initialization before
154 // getting HostResolver. 154 // getting HostResolver.
155 content::BrowserThread::PostTaskAndReplyWithResult( 155 content::BrowserThread::PostTaskAndReplyWithResult(
156 content::BrowserThread::IO, FROM_HERE, 156 content::BrowserThread::IO, FROM_HERE,
157 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, 157 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext,
158 base::Unretained( 158 base::Unretained(
159 url_request_context_factory_->GetSystemGetter())), 159 url_request_context_factory_->GetSystemGetter())),
160 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, 160 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter,
161 base::Unretained(this), host->GetID())); 161 base::Unretained(this), host->GetID()));
162 } 162 }
163 163
164 scoped_refptr<base::SingleThreadTaskRunner>
165 CastContentBrowserClient::GetMediaTaskRunner() {
166 // TODO(alokp): Obtain task runner from a local thread or mojo media app.
167 return media::MediaMessageLoop::GetTaskRunner();
168 }
169
164 #if !defined(OS_ANDROID) 170 #if !defined(OS_ANDROID)
165 scoped_refptr<media::CmaMediaPipelineClient> 171 scoped_refptr<media::CmaMediaPipelineClient>
166 CastContentBrowserClient::CreateCmaMediaPipelineClient() { 172 CastContentBrowserClient::CreateCmaMediaPipelineClient() {
167 return make_scoped_refptr(new media::CmaMediaPipelineClient()); 173 return make_scoped_refptr(new media::CmaMediaPipelineClient());
168 } 174 }
169 #endif // OS_ANDROID 175 #endif // OS_ANDROID
170 176
171 void CastContentBrowserClient::AddNetworkHintsMessageFilter( 177 void CastContentBrowserClient::AddNetworkHintsMessageFilter(
172 int render_process_id, net::URLRequestContext* context) { 178 int render_process_id, net::URLRequestContext* context) {
173 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 base::ScopedFD(minidump_file.TakePlatformFile())); 418 base::ScopedFD(minidump_file.TakePlatformFile()));
413 } 419 }
414 } 420 }
415 } 421 }
416 422
417 #else 423 #else
418 424
419 scoped_ptr<::media::CdmFactory> CastContentBrowserClient::CreateCdmFactory() { 425 scoped_ptr<::media::CdmFactory> CastContentBrowserClient::CreateCdmFactory() {
420 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 426 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
421 switches::kEnableCmaMediaPipeline)) { 427 switches::kEnableCmaMediaPipeline)) {
422 return make_scoped_ptr(new media::CastBrowserCdmFactory()); 428 return make_scoped_ptr(
429 new media::CastBrowserCdmFactory(GetMediaTaskRunner()));
423 } 430 }
424 431
425 return nullptr; 432 return nullptr;
426 } 433 }
427 434
428 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 435 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
429 const base::CommandLine& command_line, 436 const base::CommandLine& command_line,
430 int child_process_id, 437 int child_process_id,
431 content::FileDescriptorInfo* mappings) { 438 content::FileDescriptorInfo* mappings) {
432 int crash_signal_fd = GetCrashSignalFD(command_line); 439 int crash_signal_fd = GetCrashSignalFD(command_line);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 process_type, dumps_path, false /* upload */); 493 process_type, dumps_path, false /* upload */);
487 // StartUploaderThread() even though upload is diferred. 494 // StartUploaderThread() even though upload is diferred.
488 // Breakpad-related memory is freed in the uploader thread. 495 // Breakpad-related memory is freed in the uploader thread.
489 crash_handler->StartUploaderThread(); 496 crash_handler->StartUploaderThread();
490 return crash_handler; 497 return crash_handler;
491 } 498 }
492 #endif // !defined(OS_ANDROID) 499 #endif // !defined(OS_ANDROID)
493 500
494 } // namespace shell 501 } // namespace shell
495 } // namespace chromecast 502 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698