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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1837143002: media: Pass MediaPermission to MediaDrmBridge Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More plumbing Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind) 399 GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
400 : host_id_(host_id), 400 : host_id_(host_id),
401 valid_(true), 401 valid_(true),
402 in_process_(false), 402 in_process_(false),
403 swiftshader_rendering_(false), 403 swiftshader_rendering_(false),
404 kind_(kind), 404 kind_(kind),
405 process_launched_(false), 405 process_launched_(false),
406 initialized_(false), 406 initialized_(false),
407 uma_memory_stats_received_(false) { 407 uma_memory_stats_received_(false),
408 permission_service_context_(new PermissionServiceContext(this)) {
408 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 409 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
409 switches::kSingleProcess) || 410 switches::kSingleProcess) ||
410 base::CommandLine::ForCurrentProcess()->HasSwitch( 411 base::CommandLine::ForCurrentProcess()->HasSwitch(
411 switches::kInProcessGPU)) { 412 switches::kInProcessGPU)) {
412 in_process_ = true; 413 in_process_ = true;
413 } 414 }
414 415
415 // If the 'single GPU process' policy ever changes, we still want to maintain 416 // If the 'single GPU process' policy ever changes, we still want to maintain
416 // it for 'gpu thread' mode and only create one instance of host and thread. 417 // it for 'gpu thread' mode and only create one instance of host and thread.
417 DCHECK(!in_process_ || g_gpu_process_hosts[kind] == NULL); 418 DCHECK(!in_process_ || g_gpu_process_hosts[kind] == NULL);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 init_start_time_ = base::TimeTicks::Now(); 534 init_start_time_ = base::TimeTicks::Now();
534 535
535 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); 536 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD);
536 537
537 std::string channel_id = process_->GetHost()->CreateChannel(); 538 std::string channel_id = process_->GetHost()->CreateChannel();
538 if (channel_id.empty()) 539 if (channel_id.empty())
539 return false; 540 return false;
540 541
541 DCHECK(!mojo_application_host_); 542 DCHECK(!mojo_application_host_);
542 mojo_application_host_.reset(new MojoApplicationHost); 543 mojo_application_host_.reset(new MojoApplicationHost);
544 RegisterMojoServices();
543 545
544 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); 546 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine();
545 if (in_process_) { 547 if (in_process_) {
546 DCHECK_CURRENTLY_ON(BrowserThread::IO); 548 DCHECK_CURRENTLY_ON(BrowserThread::IO);
547 DCHECK(g_gpu_main_thread_factory); 549 DCHECK(g_gpu_main_thread_factory);
548 in_process_gpu_thread_.reset( 550 in_process_gpu_thread_.reset(
549 g_gpu_main_thread_factory(InProcessChildThreadParams( 551 g_gpu_main_thread_factory(InProcessChildThreadParams(
550 channel_id, base::MessageLoop::current()->task_runner(), 552 channel_id, base::MessageLoop::current()->task_runner(),
551 std::string(), mojo_application_host_->GetToken()), 553 std::string(), mojo_application_host_->GetToken()),
552 gpu_preferences)); 554 gpu_preferences));
(...skipping 11 matching lines...) Expand all
564 } else if (!LaunchGpuProcess(channel_id, &gpu_preferences)) { 566 } else if (!LaunchGpuProcess(channel_id, &gpu_preferences)) {
565 return false; 567 return false;
566 } 568 }
567 569
568 if (!Send(new GpuMsg_Initialize(gpu_preferences))) 570 if (!Send(new GpuMsg_Initialize(gpu_preferences)))
569 return false; 571 return false;
570 572
571 return true; 573 return true;
572 } 574 }
573 575
576 void GpuProcessHost::RegisterMojoServices() {
577 mojo_application_host_->service_registry()->AddService(
578 base::Bind(&PermissionServiceContext::CreateService,
579 base::Unretained(permission_service_context_.get())));
580 }
581
574 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { 582 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) {
575 BrowserThread::PostTask( 583 BrowserThread::PostTask(
576 BrowserThread::UI, 584 BrowserThread::UI,
577 FROM_HERE, 585 FROM_HERE,
578 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); 586 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message));
579 } 587 }
580 588
581 bool GpuProcessHost::Send(IPC::Message* msg) { 589 bool GpuProcessHost::Send(IPC::Message* msg) {
582 DCHECK(CalledOnValidThread()); 590 DCHECK(CalledOnValidThread());
583 if (process_->GetHost()->IsChannelOpening()) { 591 if (process_->GetHost()->IsChannelOpening()) {
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1158 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1151 ClientIdToShaderCacheMap::iterator iter = 1159 ClientIdToShaderCacheMap::iterator iter =
1152 client_id_to_shader_cache_.find(client_id); 1160 client_id_to_shader_cache_.find(client_id);
1153 // If the cache doesn't exist then this is an off the record profile. 1161 // If the cache doesn't exist then this is an off the record profile.
1154 if (iter == client_id_to_shader_cache_.end()) 1162 if (iter == client_id_to_shader_cache_.end())
1155 return; 1163 return;
1156 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1164 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1157 } 1165 }
1158 1166
1159 } // namespace content 1167 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/media/cdm/browser_cdm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698