OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/leak_annotations.h" |
13 #include "base/location.h" | 14 #include "base/location.h" |
14 #include "base/memory/discardable_memory.h" | 15 #include "base/memory/discardable_memory.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
19 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
20 #include "cc/output/buffer_to_texture_target_map.h" | 21 #include "cc/output/buffer_to_texture_target_map.h" |
21 #include "content/app/mojo/mojo_init.h" | 22 #include "content/app/mojo/mojo_init.h" |
22 #include "content/common/in_process_child_thread_params.h" | 23 #include "content/common/in_process_child_thread_params.h" |
23 #include "content/common/resource_messages.h" | 24 #include "content/common/resource_messages.h" |
24 #include "content/common/service_manager/child_connection.h" | 25 #include "content/common/service_manager/child_connection.h" |
25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
27 #include "content/public/common/content_client.h" | 28 #include "content/public/common/content_client.h" |
28 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
29 #include "content/public/common/service_manager_connection.h" | 30 #include "content/public/common/service_manager_connection.h" |
30 #include "content/public/common/service_names.mojom.h" | 31 #include "content/public/common/service_names.mojom.h" |
31 #include "content/public/renderer/content_renderer_client.h" | 32 #include "content/public/renderer/content_renderer_client.h" |
32 #include "content/public/test/content_browser_test.h" | 33 #include "content/public/test/content_browser_test.h" |
33 #include "content/public/test/content_browser_test_utils.h" | 34 #include "content/public/test/content_browser_test_utils.h" |
34 #include "content/public/test/test_browser_thread_bundle.h" | 35 #include "content/public/test/test_browser_thread_bundle.h" |
35 #include "content/public/test/test_content_client_initializer.h" | 36 #include "content/public/test/test_content_client_initializer.h" |
| 37 #include "content/public/test/test_launcher.h" |
36 #include "content/public/test/test_service_manager_context.h" | 38 #include "content/public/test/test_service_manager_context.h" |
37 #include "content/renderer/render_process_impl.h" | 39 #include "content/renderer/render_process_impl.h" |
38 #include "content/test/mock_render_process.h" | 40 #include "content/test/mock_render_process.h" |
39 #include "gpu/GLES2/gl2extchromium.h" | 41 #include "gpu/GLES2/gl2extchromium.h" |
40 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 42 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
41 #include "gpu/ipc/host/gpu_switches.h" | 43 #include "gpu/ipc/host/gpu_switches.h" |
42 #include "ipc/ipc.mojom.h" | 44 #include "ipc/ipc.mojom.h" |
43 #include "ipc/ipc_channel_mojo.h" | 45 #include "ipc/ipc_channel_mojo.h" |
44 #include "mojo/edk/embedder/embedder.h" | 46 #include "mojo/edk/embedder/embedder.h" |
45 #include "mojo/edk/test/scoped_ipc_support.h" | 47 #include "mojo/edk/test/scoped_ipc_support.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 InProcessChildThreadParams(io_task_runner, | 216 InProcessChildThreadParams(io_task_runner, |
215 child_connection_->service_token()), | 217 child_connection_->service_token()), |
216 std::move(renderer_scheduler), test_task_counter); | 218 std::move(renderer_scheduler), test_task_counter); |
217 cmd->InitFromArgv(old_argv); | 219 cmd->InitFromArgv(old_argv); |
218 | 220 |
219 test_msg_filter_ = make_scoped_refptr( | 221 test_msg_filter_ = make_scoped_refptr( |
220 new QuitOnTestMsgFilter(base::MessageLoop::current())); | 222 new QuitOnTestMsgFilter(base::MessageLoop::current())); |
221 thread_->AddFilter(test_msg_filter_.get()); | 223 thread_->AddFilter(test_msg_filter_.get()); |
222 } | 224 } |
223 | 225 |
| 226 void TearDown() override { |
| 227 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 228 kSingleProcessTestsFlag)) { |
| 229 // In a single-process mode, we need to avoid destructing mock_process_ |
| 230 // because it will call _exit(0) and kill the process before the browser |
| 231 // side is ready to exit. |
| 232 ANNOTATE_LEAKING_OBJECT_PTR(mock_process_.get()); |
| 233 mock_process_.release(); |
| 234 } |
| 235 } |
| 236 |
224 IPC::Sender* sender() { return channel_.get(); } | 237 IPC::Sender* sender() { return channel_.get(); } |
225 | 238 |
226 scoped_refptr<TestTaskCounter> test_task_counter_; | 239 scoped_refptr<TestTaskCounter> test_task_counter_; |
227 TestContentClientInitializer content_client_initializer_; | 240 TestContentClientInitializer content_client_initializer_; |
228 std::unique_ptr<ContentRendererClient> content_renderer_client_; | 241 std::unique_ptr<ContentRendererClient> content_renderer_client_; |
229 | 242 |
230 std::unique_ptr<TestBrowserThreadBundle> browser_threads_; | 243 std::unique_ptr<TestBrowserThreadBundle> browser_threads_; |
231 std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support_; | 244 std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipc_support_; |
232 std::unique_ptr<TestServiceManagerContext> shell_context_; | 245 std::unique_ptr<TestServiceManagerContext> shell_context_; |
233 std::unique_ptr<ChildConnection> child_connection_; | 246 std::unique_ptr<ChildConnection> child_connection_; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // These formats are guaranteed to work on all platforms. | 386 // These formats are guaranteed to work on all platforms. |
374 ::testing::Values(gfx::BufferFormat::R_8, | 387 ::testing::Values(gfx::BufferFormat::R_8, |
375 gfx::BufferFormat::BGR_565, | 388 gfx::BufferFormat::BGR_565, |
376 gfx::BufferFormat::RGBA_4444, | 389 gfx::BufferFormat::RGBA_4444, |
377 gfx::BufferFormat::RGBA_8888, | 390 gfx::BufferFormat::RGBA_8888, |
378 gfx::BufferFormat::BGRA_8888, | 391 gfx::BufferFormat::BGRA_8888, |
379 gfx::BufferFormat::YVU_420))); | 392 gfx::BufferFormat::YVU_420))); |
380 | 393 |
381 } // namespace | 394 } // namespace |
382 } // namespace content | 395 } // namespace content |
OLD | NEW |