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

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

Issue 16465005: Fix dcheck in ContentBrowserTestSanityTest.SingleProcess in win aura. The problem was that GpuProce… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/content_browser_test_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 #if !defined(OS_CHROMEOS) 510 #if !defined(OS_CHROMEOS)
511 // The gpu process is too unstable to use. Disable it for current 511 // The gpu process is too unstable to use. Disable it for current
512 // session. 512 // session.
513 hardware_gpu_enabled_ = false; 513 hardware_gpu_enabled_ = false;
514 GpuDataManagerImpl::GetInstance()->DisableHardwareAcceleration(); 514 GpuDataManagerImpl::GetInstance()->DisableHardwareAcceleration();
515 #endif 515 #endif
516 } 516 }
517 } 517 }
518 } 518 }
519 519
520 int exit_code; 520 // In case we never started, clean up.
521 base::TerminationStatus status = process_->GetTerminationStatus(&exit_code); 521 while (!queued_messages_.empty()) {
522 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", 522 delete queued_messages_.front();
523 status, 523 queued_messages_.pop();
524 base::TERMINATION_STATUS_MAX_ENUM); 524 }
525
526 // This is only called on the IO thread so no race against the constructor
527 // for another GpuProcessHost.
528 if (g_gpu_process_hosts[kind_] == this)
529 g_gpu_process_hosts[kind_] = NULL;
530
531 // If there are any remaining offscreen contexts at the point the
532 // GPU process exits, assume something went wrong, and block their
533 // URLs from accessing client 3D APIs without prompting.
534 BlockLiveOffscreenContexts();
525 535
526 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitSurfaceCount", 536 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitSurfaceCount",
527 GpuSurfaceTracker::Get()->GetSurfaceCount()); 537 GpuSurfaceTracker::Get()->GetSurfaceCount());
528 UMA_HISTOGRAM_BOOLEAN("GPU.AtExitReceivedMemoryStats", 538 UMA_HISTOGRAM_BOOLEAN("GPU.AtExitReceivedMemoryStats",
529 uma_memory_stats_received_); 539 uma_memory_stats_received_);
530 540
531 if (uma_memory_stats_received_) { 541 if (uma_memory_stats_received_) {
532 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitManagedMemoryClientCount", 542 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitManagedMemoryClientCount",
533 uma_memory_stats_.client_count); 543 uma_memory_stats_.client_count);
534 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitContextGroupCount", 544 UMA_HISTOGRAM_COUNTS_100("GPU.AtExitContextGroupCount",
535 uma_memory_stats_.context_group_count); 545 uma_memory_stats_.context_group_count);
536 UMA_HISTOGRAM_CUSTOM_COUNTS( 546 UMA_HISTOGRAM_CUSTOM_COUNTS(
537 "GPU.AtExitMBytesAllocated", 547 "GPU.AtExitMBytesAllocated",
538 uma_memory_stats_.bytes_allocated_current / 1024 / 1024, 1, 2000, 50); 548 uma_memory_stats_.bytes_allocated_current / 1024 / 1024, 1, 2000, 50);
539 UMA_HISTOGRAM_CUSTOM_COUNTS( 549 UMA_HISTOGRAM_CUSTOM_COUNTS(
540 "GPU.AtExitMBytesAllocatedMax", 550 "GPU.AtExitMBytesAllocatedMax",
541 uma_memory_stats_.bytes_allocated_max / 1024 / 1024, 1, 2000, 50); 551 uma_memory_stats_.bytes_allocated_max / 1024 / 1024, 1, 2000, 50);
542 UMA_HISTOGRAM_CUSTOM_COUNTS( 552 UMA_HISTOGRAM_CUSTOM_COUNTS(
543 "GPU.AtExitMBytesLimit", 553 "GPU.AtExitMBytesLimit",
544 uma_memory_stats_.bytes_limit / 1024 / 1024, 1, 2000, 50); 554 uma_memory_stats_.bytes_limit / 1024 / 1024, 1, 2000, 50);
545 } 555 }
546 556
547 if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION || 557 std::string message;
548 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { 558 if (!in_process_) {
549 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessExitCode", 559 int exit_code;
550 exit_code, 560 base::TerminationStatus status = process_->GetTerminationStatus(&exit_code);
551 RESULT_CODE_LAST_CODE); 561 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus",
552 } 562 status,
563 base::TERMINATION_STATUS_MAX_ENUM);
553 564
554 // In case we never started, clean up. 565 if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION ||
555 while (!queued_messages_.empty()) { 566 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
556 delete queued_messages_.front(); 567 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessExitCode",
557 queued_messages_.pop(); 568 exit_code,
558 } 569 RESULT_CODE_LAST_CODE);
570 }
559 571
560 // This is only called on the IO thread so no race against the constructor 572 switch (status) {
561 // for another GpuProcessHost. 573 case base::TERMINATION_STATUS_NORMAL_TERMINATION:
562 if (g_gpu_process_hosts[kind_] == this) 574 message = "The GPU process exited normally. Everything is okay.";
563 g_gpu_process_hosts[kind_] = NULL; 575 break;
564 576 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
565 // If there are any remaining offscreen contexts at the point the 577 message = base::StringPrintf(
566 // GPU process exits, assume something went wrong, and block their 578 "The GPU process exited with code %d.",
567 // URLs from accessing client 3D APIs without prompting. 579 exit_code);
568 BlockLiveOffscreenContexts(); 580 break;
569 581 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
570 std::string message; 582 message = "You killed the GPU process! Why?";
571 switch (status) { 583 break;
572 case base::TERMINATION_STATUS_NORMAL_TERMINATION: 584 case base::TERMINATION_STATUS_PROCESS_CRASHED:
573 message = "The GPU process exited normally. Everything is okay."; 585 message = "The GPU process crashed!";
574 break; 586 break;
575 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: 587 default:
576 message = base::StringPrintf( 588 break;
577 "The GPU process exited with code %d.", 589 }
578 exit_code);
579 break;
580 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
581 message = "You killed the GPU process! Why?";
582 break;
583 case base::TERMINATION_STATUS_PROCESS_CRASHED:
584 message = "The GPU process crashed!";
585 break;
586 default:
587 break;
588 } 590 }
589 591
590 BrowserThread::PostTask(BrowserThread::UI, 592 BrowserThread::PostTask(BrowserThread::UI,
591 FROM_HERE, 593 FROM_HERE,
592 base::Bind(&GpuProcessHostUIShim::Destroy, 594 base::Bind(&GpuProcessHostUIShim::Destroy,
593 host_id_, 595 host_id_,
594 message)); 596 message));
595 } 597 }
596 598
597 bool GpuProcessHost::Init() { 599 bool GpuProcessHost::Init() {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1277 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1276 ClientIdToShaderCacheMap::iterator iter = 1278 ClientIdToShaderCacheMap::iterator iter =
1277 client_id_to_shader_cache_.find(client_id); 1279 client_id_to_shader_cache_.find(client_id);
1278 // If the cache doesn't exist then this is an off the record profile. 1280 // If the cache doesn't exist then this is an off the record profile.
1279 if (iter == client_id_to_shader_cache_.end()) 1281 if (iter == client_id_to_shader_cache_.end())
1280 return; 1282 return;
1281 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1283 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1282 } 1284 }
1283 1285
1284 } // namespace content 1286 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/content_browser_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698