| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 enum GPUProcessLifetimeEvent { | 42 enum GPUProcessLifetimeEvent { |
| 43 LAUNCHED, | 43 LAUNCHED, |
| 44 DIED_FIRST_TIME, | 44 DIED_FIRST_TIME, |
| 45 DIED_SECOND_TIME, | 45 DIED_SECOND_TIME, |
| 46 DIED_THIRD_TIME, | 46 DIED_THIRD_TIME, |
| 47 DIED_FOURTH_TIME, | 47 DIED_FOURTH_TIME, |
| 48 GPU_PROCESS_LIFETIME_EVENT_MAX | 48 GPU_PROCESS_LIFETIME_EVENT_MAX |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // A global map from GPU process host ID to GpuProcessHost. | 51 // A global map from GPU process host ID to GpuProcessHost. |
| 52 static base::LazyInstance<IDMap<GpuProcessHost> > g_hosts_by_id( | 52 static base::LazyInstance<IDMap<GpuProcessHost> > g_hosts_by_id = |
| 53 base::LINKER_INITIALIZED); | 53 LAZY_INSTANCE_INITIALIZER; |
| 54 | 54 |
| 55 // Number of times the gpu process has crashed in the current browser session. | 55 // Number of times the gpu process has crashed in the current browser session. |
| 56 static int g_gpu_crash_count = 0; | 56 static int g_gpu_crash_count = 0; |
| 57 | 57 |
| 58 // Maximum number of times the gpu process is allowed to crash in a session. | 58 // Maximum number of times the gpu process is allowed to crash in a session. |
| 59 // Once this limit is reached, any request to launch the gpu process will fail. | 59 // Once this limit is reached, any request to launch the gpu process will fail. |
| 60 static const int kGpuMaxCrashCount = 3; | 60 static const int kGpuMaxCrashCount = 3; |
| 61 | 61 |
| 62 int g_last_host_id = 0; | 62 int g_last_host_id = 0; |
| 63 | 63 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 switches::kDisableLogging, | 586 switches::kDisableLogging, |
| 587 switches::kEnableGPUServiceLogging, | 587 switches::kEnableGPUServiceLogging, |
| 588 switches::kEnableLogging, | 588 switches::kEnableLogging, |
| 589 #if defined(OS_MACOSX) | 589 #if defined(OS_MACOSX) |
| 590 switches::kEnableSandboxLogging, | 590 switches::kEnableSandboxLogging, |
| 591 #endif | 591 #endif |
| 592 switches::kGpuNoContextLost, | 592 switches::kGpuNoContextLost, |
| 593 switches::kGpuStartupDialog, | 593 switches::kGpuStartupDialog, |
| 594 switches::kLoggingLevel, | 594 switches::kLoggingLevel, |
| 595 switches::kNoSandbox, | 595 switches::kNoSandbox, |
| 596 switches::kTraceStartup, | |
| 597 }; | 596 }; |
| 598 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, | 597 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 599 arraysize(kSwitchNames)); | 598 arraysize(kSwitchNames)); |
| 600 | 599 |
| 601 // If --ignore-gpu-blacklist is passed in, don't send in crash reports | 600 // If --ignore-gpu-blacklist is passed in, don't send in crash reports |
| 602 // because GPU is expected to be unreliable. | 601 // because GPU is expected to be unreliable. |
| 603 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) && | 602 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) && |
| 604 !cmd_line->HasSwitch(switches::kDisableBreakpad)) | 603 !cmd_line->HasSwitch(switches::kDisableBreakpad)) |
| 605 cmd_line->AppendSwitch(switches::kDisableBreakpad); | 604 cmd_line->AppendSwitch(switches::kDisableBreakpad); |
| 606 | 605 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
| 649 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
| 650 } | 649 } |
| 651 | 650 |
| 652 void GpuProcessHost::CreateCommandBufferError( | 651 void GpuProcessHost::CreateCommandBufferError( |
| 653 CreateCommandBufferCallback* callback, int32 route_id) { | 652 CreateCommandBufferCallback* callback, int32 route_id) { |
| 654 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
| 655 wrapped_callback(callback); | 654 wrapped_callback(callback); |
| 656 callback->Run(route_id); | 655 callback->Run(route_id); |
| 657 } | 656 } |
| OLD | NEW |