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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 switches::kDisableLogging, | 554 switches::kDisableLogging, |
555 switches::kEnableGPUServiceLogging, | 555 switches::kEnableGPUServiceLogging, |
556 switches::kEnableLogging, | 556 switches::kEnableLogging, |
557 #if defined(OS_MACOSX) | 557 #if defined(OS_MACOSX) |
558 switches::kEnableSandboxLogging, | 558 switches::kEnableSandboxLogging, |
559 #endif | 559 #endif |
560 switches::kGpuNoContextLost, | 560 switches::kGpuNoContextLost, |
561 switches::kGpuStartupDialog, | 561 switches::kGpuStartupDialog, |
562 switches::kLoggingLevel, | 562 switches::kLoggingLevel, |
563 switches::kNoSandbox, | 563 switches::kNoSandbox, |
564 switches::kTraceStartup, | |
565 }; | 564 }; |
566 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, | 565 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
567 arraysize(kSwitchNames)); | 566 arraysize(kSwitchNames)); |
568 | 567 |
569 // If --ignore-gpu-blacklist is passed in, don't send in crash reports | 568 // If --ignore-gpu-blacklist is passed in, don't send in crash reports |
570 // because GPU is expected to be unreliable. | 569 // because GPU is expected to be unreliable. |
571 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) && | 570 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) && |
572 !cmd_line->HasSwitch(switches::kDisableBreakpad)) | 571 !cmd_line->HasSwitch(switches::kDisableBreakpad)) |
573 cmd_line->AppendSwitch(switches::kDisableBreakpad); | 572 cmd_line->AppendSwitch(switches::kDisableBreakpad); |
574 | 573 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 611 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
613 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 612 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
614 } | 613 } |
615 | 614 |
616 void GpuProcessHost::CreateCommandBufferError( | 615 void GpuProcessHost::CreateCommandBufferError( |
617 CreateCommandBufferCallback* callback, int32 route_id) { | 616 CreateCommandBufferCallback* callback, int32 route_id) { |
618 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 617 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
619 wrapped_callback(callback); | 618 wrapped_callback(callback); |
620 callback->Run(route_id); | 619 callback->Run(route_id); |
621 } | 620 } |
OLD | NEW |