OLD | NEW |
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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "content/common/child_process.h" | 16 #include "content/common/child_process.h" |
17 #include "content/common/gpu/gpu_channel_manager.h" | 17 #include "content/common/gpu/gpu_channel_manager.h" |
18 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
21 #include "gpu/command_buffer/service/mailbox_manager.h" | 21 #include "gpu/command_buffer/service/mailbox_manager.h" |
22 #include "ui/gfx/gl/gl_context.h" | 22 #include "ui/gl/gl_context.h" |
23 #include "ui/gfx/gl/gl_surface.h" | 23 #include "ui/gl/gl_surface.h" |
24 | 24 |
25 #if defined(OS_POSIX) | 25 #if defined(OS_POSIX) |
26 #include "ipc/ipc_channel_posix.h" | 26 #include "ipc/ipc_channel_posix.h" |
27 #endif | 27 #endif |
28 | 28 |
29 namespace { | 29 namespace { |
30 // The first time polling a fence, delay some extra time to allow other | 30 // The first time polling a fence, delay some extra time to allow other |
31 // stubs to process some work, or else the timing of the fences could | 31 // stubs to process some work, or else the timing of the fences could |
32 // allow a pattern of alternating fast and slow frames to occur. | 32 // allow a pattern of alternating fast and slow frames to occur. |
33 const int64 kHandleMoreWorkPeriodMs = 2; | 33 const int64 kHandleMoreWorkPeriodMs = 2; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) { | 426 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) { |
427 if (gpu_preference == gfx::PreferDiscreteGpu) | 427 if (gpu_preference == gfx::PreferDiscreteGpu) |
428 ++num_contexts_preferring_discrete_gpu_; | 428 ++num_contexts_preferring_discrete_gpu_; |
429 } | 429 } |
430 | 430 |
431 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) { | 431 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) { |
432 if (gpu_preference == gfx::PreferDiscreteGpu) | 432 if (gpu_preference == gfx::PreferDiscreteGpu) |
433 --num_contexts_preferring_discrete_gpu_; | 433 --num_contexts_preferring_discrete_gpu_; |
434 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0); | 434 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0); |
435 } | 435 } |
OLD | NEW |