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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/hash.h" | 8 #include "base/hash.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/gpu/gpu_channel.h" | 14 #include "content/common/gpu/gpu_channel.h" |
15 #include "content/common/gpu/gpu_channel_manager.h" | 15 #include "content/common/gpu/gpu_channel_manager.h" |
16 #include "content/common/gpu/gpu_command_buffer_stub.h" | 16 #include "content/common/gpu/gpu_command_buffer_stub.h" |
17 #include "content/common/gpu/gpu_memory_manager.h" | 17 #include "content/common/gpu/gpu_memory_manager.h" |
18 #include "content/common/gpu/gpu_memory_tracking.h" | 18 #include "content/common/gpu/gpu_memory_tracking.h" |
19 #include "content/common/gpu/gpu_messages.h" | 19 #include "content/common/gpu/gpu_messages.h" |
20 #include "content/common/gpu/gpu_watchdog.h" | 20 #include "content/common/gpu/gpu_watchdog.h" |
21 #include "content/common/gpu/image_transport_surface.h" | 21 #include "content/common/gpu/image_transport_surface.h" |
22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
23 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | 23 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
24 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
| 25 #include "content/public/common/content_switches.h" |
25 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
27 #include "gpu/command_buffer/common/mailbox.h" | 28 #include "gpu/command_buffer/common/mailbox.h" |
28 #include "gpu/command_buffer/service/gl_context_virtual.h" | 29 #include "gpu/command_buffer/service/gl_context_virtual.h" |
29 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 30 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
30 #include "gpu/command_buffer/service/image_factory.h" | 31 #include "gpu/command_buffer/service/image_factory.h" |
31 #include "gpu/command_buffer/service/image_manager.h" | 32 #include "gpu/command_buffer/service/image_manager.h" |
32 #include "gpu/command_buffer/service/logger.h" | 33 #include "gpu/command_buffer/service/logger.h" |
33 #include "gpu/command_buffer/service/mailbox_manager.h" | 34 #include "gpu/command_buffer/service/mailbox_manager.h" |
34 #include "gpu/command_buffer/service/memory_tracking.h" | 35 #include "gpu/command_buffer/service/memory_tracking.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 new base::SharedMemory(shared_state_handle, false)); | 466 new base::SharedMemory(shared_state_handle, false)); |
466 | 467 |
467 command_buffer_.reset(new gpu::CommandBufferService( | 468 command_buffer_.reset(new gpu::CommandBufferService( |
468 context_group_->transfer_buffer_manager())); | 469 context_group_->transfer_buffer_manager())); |
469 | 470 |
470 bool result = command_buffer_->Initialize(); | 471 bool result = command_buffer_->Initialize(); |
471 DCHECK(result); | 472 DCHECK(result); |
472 | 473 |
473 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); | 474 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); |
474 | 475 |
| 476 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 477 switches::kSingleProcess) && |
| 478 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 479 switches::kInProcessGPU)) { |
| 480 decoder_->SetAllowExit(true); |
| 481 } |
| 482 |
475 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), | 483 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), |
476 decoder_.get(), | 484 decoder_.get(), |
477 decoder_.get())); | 485 decoder_.get())); |
478 if (preemption_flag_.get()) | 486 if (preemption_flag_.get()) |
479 scheduler_->SetPreemptByFlag(preemption_flag_); | 487 scheduler_->SetPreemptByFlag(preemption_flag_); |
480 | 488 |
481 decoder_->set_engine(scheduler_.get()); | 489 decoder_->set_engine(scheduler_.get()); |
482 | 490 |
483 if (!handle_.is_null()) { | 491 if (!handle_.is_null()) { |
484 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 492 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 result)); | 1121 result)); |
1114 } | 1122 } |
1115 | 1123 |
1116 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1124 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1117 base::TimeDelta interval) { | 1125 base::TimeDelta interval) { |
1118 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1126 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1119 interval)); | 1127 interval)); |
1120 } | 1128 } |
1121 | 1129 |
1122 } // namespace content | 1130 } // namespace content |
OLD | NEW |