| 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/location.h" | 13 #include "base/location.h" |
| 14 #include "base/memory/discardable_memory.h" | 14 #include "base/memory/discardable_memory.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "cc/output/buffer_to_texture_target_map.h" |
| 19 #include "components/scheduler/renderer/renderer_scheduler.h" | 20 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 20 #include "content/app/mojo/mojo_init.h" | 21 #include "content/app/mojo/mojo_init.h" |
| 21 #include "content/common/in_process_child_thread_params.h" | 22 #include "content/common/in_process_child_thread_params.h" |
| 22 #include "content/common/resource_messages.h" | 23 #include "content/common/resource_messages.h" |
| 23 #include "content/common/websocket_messages.h" | 24 #include "content/common/websocket_messages.h" |
| 24 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
| 25 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/renderer/content_renderer_client.h" | 28 #include "content/public/renderer/content_renderer_client.h" |
| 28 #include "content/renderer/render_process_impl.h" | 29 #include "content/renderer/render_process_impl.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); | 161 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); |
| 161 | 162 |
| 162 mock_process_.reset(new MockRenderProcess); | 163 mock_process_.reset(new MockRenderProcess); |
| 163 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); | 164 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); |
| 164 | 165 |
| 165 // RenderThreadImpl expects the browser to pass these flags. | 166 // RenderThreadImpl expects the browser to pass these flags. |
| 166 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 167 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 167 base::CommandLine::StringVector old_argv = cmd->argv(); | 168 base::CommandLine::StringVector old_argv = cmd->argv(); |
| 168 | 169 |
| 169 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); | 170 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); |
| 170 std::string image_targets; | 171 cmd->AppendSwitchASCII( |
| 171 for (size_t format = 0; | 172 switches::kContentImageTextureTarget, |
| 172 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | 173 cc::BufferToTextureTargetMapToString( |
| 173 if (!image_targets.empty()) | 174 cc::DefaultBufferToTextureTargetMapForTesting())); |
| 174 image_targets += ","; | |
| 175 image_targets += base::UintToString(GL_TEXTURE_2D); | |
| 176 } | |
| 177 cmd->AppendSwitchASCII(switches::kContentImageTextureTarget, image_targets); | |
| 178 | 175 |
| 179 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler = | 176 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler = |
| 180 scheduler::RendererScheduler::Create(); | 177 scheduler::RendererScheduler::Create(); |
| 181 InitializeMojo(); | 178 InitializeMojo(); |
| 182 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter( | 179 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter( |
| 183 test_task_counter_.get()); | 180 test_task_counter_.get()); |
| 184 thread_ = new RenderThreadImplForTest( | 181 thread_ = new RenderThreadImplForTest( |
| 185 InProcessChildThreadParams(test_helper_->GetChannelId(), | 182 InProcessChildThreadParams(test_helper_->GetChannelId(), |
| 186 test_helper_->GetIOTaskRunner(), | 183 test_helper_->GetIOTaskRunner(), |
| 187 test_helper_->GetMojoIpcToken(), | 184 test_helper_->GetMojoIpcToken(), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 235 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
| 239 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 236 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
| 240 | 237 |
| 241 base::RunLoop().Run(); | 238 base::RunLoop().Run(); |
| 242 | 239 |
| 243 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 240 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
| 244 } | 241 } |
| 245 | 242 |
| 246 } // namespace | 243 } // namespace |
| 247 } // namespace content | 244 } // namespace content |
| OLD | NEW |