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 "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "components/tracing/common/tracing_switches.h" | 28 #include "components/tracing/common/tracing_switches.h" |
29 #include "content/browser/browser_child_process_host_impl.h" | 29 #include "content/browser/browser_child_process_host_impl.h" |
30 #include "content/browser/gpu/compositor_util.h" | 30 #include "content/browser/gpu/compositor_util.h" |
31 #include "content/browser/gpu/gpu_data_manager_impl.h" | 31 #include "content/browser/gpu/gpu_data_manager_impl.h" |
32 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 32 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
33 #include "content/browser/gpu/shader_disk_cache.h" | 33 #include "content/browser/gpu/shader_disk_cache.h" |
34 #include "content/browser/mojo/constants.h" | 34 #include "content/browser/mojo/constants.h" |
35 #include "content/browser/mojo/mojo_child_connection.h" | 35 #include "content/browser/mojo/mojo_child_connection.h" |
36 #include "content/browser/mojo/mojo_shell_context.h" | |
37 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
38 #include "content/common/child_process_host_impl.h" | 37 #include "content/common/child_process_host_impl.h" |
39 #include "content/common/establish_channel_params.h" | 38 #include "content/common/establish_channel_params.h" |
40 #include "content/common/gpu_host_messages.h" | 39 #include "content/common/gpu_host_messages.h" |
41 #include "content/common/in_process_child_thread_params.h" | 40 #include "content/common/in_process_child_thread_params.h" |
42 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
43 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/content_browser_client.h" | 43 #include "content/public/browser/content_browser_client.h" |
45 #include "content/public/browser/gpu_utils.h" | 44 #include "content/public/browser/gpu_utils.h" |
46 #include "content/public/browser/render_process_host.h" | 45 #include "content/public/browser/render_process_host.h" |
47 #include "content/public/browser/render_widget_host_view.h" | 46 #include "content/public/browser/render_widget_host_view.h" |
48 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 47 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 48 #include "content/public/browser/shell_context.h" |
49 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
50 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
51 #include "content/public/common/mojo_channel_switches.h" | 51 #include "content/public/common/mojo_channel_switches.h" |
52 #include "content/public/common/mojo_shell_connection.h" | 52 #include "content/public/common/mojo_shell_connection.h" |
53 #include "content/public/common/result_codes.h" | 53 #include "content/public/common/result_codes.h" |
54 #include "content/public/common/sandbox_type.h" | 54 #include "content/public/common/sandbox_type.h" |
55 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 55 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
56 #include "gpu/command_buffer/service/gpu_preferences.h" | 56 #include "gpu/command_buffer/service/gpu_preferences.h" |
57 #include "gpu/command_buffer/service/gpu_switches.h" | 57 #include "gpu/command_buffer/service/gpu_switches.h" |
58 #include "ipc/ipc_channel_handle.h" | 58 #include "ipc/ipc_channel_handle.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 std::string channel_id = process_->GetHost()->CreateChannel(); | 555 std::string channel_id = process_->GetHost()->CreateChannel(); |
556 if (channel_id.empty()) | 556 if (channel_id.empty()) |
557 return false; | 557 return false; |
558 | 558 |
559 DCHECK(!mojo_child_connection_); | 559 DCHECK(!mojo_child_connection_); |
560 mojo_child_connection_.reset(new MojoChildConnection( | 560 mojo_child_connection_.reset(new MojoChildConnection( |
561 kGpuMojoApplicationName, | 561 kGpuMojoApplicationName, |
562 "", | 562 "", |
563 child_token_, | 563 child_token_, |
564 MojoShellContext::GetConnectorForIOThread())); | 564 ShellContext::GetConnectorForIOThread())); |
565 | 565 |
566 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); | 566 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); |
567 if (in_process_) { | 567 if (in_process_) { |
568 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 568 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
569 DCHECK(g_gpu_main_thread_factory); | 569 DCHECK(g_gpu_main_thread_factory); |
570 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( | 570 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( |
571 InProcessChildThreadParams( | 571 InProcessChildThreadParams( |
572 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), | 572 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), |
573 mojo_child_connection_->shell_client_token()), | 573 mojo_child_connection_->shell_client_token()), |
574 gpu_preferences)); | 574 gpu_preferences)); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1182 ClientIdToShaderCacheMap::iterator iter = | 1182 ClientIdToShaderCacheMap::iterator iter = |
1183 client_id_to_shader_cache_.find(client_id); | 1183 client_id_to_shader_cache_.find(client_id); |
1184 // If the cache doesn't exist then this is an off the record profile. | 1184 // If the cache doesn't exist then this is an off the record profile. |
1185 if (iter == client_id_to_shader_cache_.end()) | 1185 if (iter == client_id_to_shader_cache_.end()) |
1186 return; | 1186 return; |
1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace content | 1190 } // namespace content |
OLD | NEW |