| 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 "components/scheduler/renderer/renderer_scheduler.h" | |
| 20 #include "content/app/mojo/mojo_init.h" | 19 #include "content/app/mojo/mojo_init.h" |
| 21 #include "content/common/in_process_child_thread_params.h" | 20 #include "content/common/in_process_child_thread_params.h" |
| 22 #include "content/common/resource_messages.h" | 21 #include "content/common/resource_messages.h" |
| 23 #include "content/common/websocket_messages.h" | 22 #include "content/common/websocket_messages.h" |
| 24 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
| 25 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/renderer/content_renderer_client.h" | 26 #include "content/public/renderer/content_renderer_client.h" |
| 28 #include "content/renderer/render_process_impl.h" | 27 #include "content/renderer/render_process_impl.h" |
| 29 #include "content/test/mock_render_process.h" | 28 #include "content/test/mock_render_process.h" |
| 30 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" | 29 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" |
| 31 #include "gpu/GLES2/gl2extchromium.h" | 30 #include "gpu/GLES2/gl2extchromium.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 33 | 33 |
| 34 // IPC messages for testing ---------------------------------------------------- | 34 // IPC messages for testing ---------------------------------------------------- |
| 35 | 35 |
| 36 // TODO(mdempsky): Fix properly by moving into a separate | 36 // TODO(mdempsky): Fix properly by moving into a separate |
| 37 // browsertest_message_generator.cc file. | 37 // browsertest_message_generator.cc file. |
| 38 #undef IPC_IPC_MESSAGE_MACROS_H_ | 38 #undef IPC_IPC_MESSAGE_MACROS_H_ |
| 39 #undef IPC_MESSAGE_EXTRA | 39 #undef IPC_MESSAGE_EXTRA |
| 40 #define IPC_MESSAGE_IMPL | 40 #define IPC_MESSAGE_IMPL |
| 41 #include "ipc/ipc_message_macros.h" | 41 #include "ipc/ipc_message_macros.h" |
| 42 #include "ipc/ipc_message_templates_impl.h" | 42 #include "ipc/ipc_message_templates_impl.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #if defined(COMPILER_MSVC) | 97 #if defined(COMPILER_MSVC) |
| 98 // See explanation for other RenderViewHostImpl which is the same issue. | 98 // See explanation for other RenderViewHostImpl which is the same issue. |
| 99 #pragma warning(push) | 99 #pragma warning(push) |
| 100 #pragma warning(disable: 4250) | 100 #pragma warning(disable: 4250) |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 class RenderThreadImplForTest : public RenderThreadImpl { | 103 class RenderThreadImplForTest : public RenderThreadImpl { |
| 104 public: | 104 public: |
| 105 RenderThreadImplForTest( | 105 RenderThreadImplForTest( |
| 106 const InProcessChildThreadParams& params, | 106 const InProcessChildThreadParams& params, |
| 107 std::unique_ptr<scheduler::RendererScheduler> scheduler, | 107 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler, |
| 108 scoped_refptr<base::SingleThreadTaskRunner>& test_task_counter) | 108 scoped_refptr<base::SingleThreadTaskRunner>& test_task_counter) |
| 109 : RenderThreadImpl(params, std::move(scheduler), test_task_counter) {} | 109 : RenderThreadImpl(params, std::move(scheduler), test_task_counter) {} |
| 110 | 110 |
| 111 ~RenderThreadImplForTest() override {} | 111 ~RenderThreadImplForTest() override {} |
| 112 | 112 |
| 113 using ChildThreadImpl::OnMessageReceived; | 113 using ChildThreadImpl::OnMessageReceived; |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 }; | 116 }; |
| 117 | 117 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); | 169 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); |
| 170 std::string image_targets; | 170 std::string image_targets; |
| 171 for (size_t format = 0; | 171 for (size_t format = 0; |
| 172 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | 172 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { |
| 173 if (!image_targets.empty()) | 173 if (!image_targets.empty()) |
| 174 image_targets += ","; | 174 image_targets += ","; |
| 175 image_targets += base::UintToString(GL_TEXTURE_2D); | 175 image_targets += base::UintToString(GL_TEXTURE_2D); |
| 176 } | 176 } |
| 177 cmd->AppendSwitchASCII(switches::kContentImageTextureTarget, image_targets); | 177 cmd->AppendSwitchASCII(switches::kContentImageTextureTarget, image_targets); |
| 178 | 178 |
| 179 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler = | 179 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler = |
| 180 scheduler::RendererScheduler::Create(); | 180 blink::scheduler::RendererScheduler::Create(); |
| 181 InitializeMojo(); | 181 InitializeMojo(); |
| 182 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter( | 182 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter( |
| 183 test_task_counter_.get()); | 183 test_task_counter_.get()); |
| 184 thread_ = new RenderThreadImplForTest( | 184 thread_ = new RenderThreadImplForTest( |
| 185 InProcessChildThreadParams(test_helper_->GetChannelId(), | 185 InProcessChildThreadParams(test_helper_->GetChannelId(), |
| 186 test_helper_->GetIOTaskRunner(), | 186 test_helper_->GetIOTaskRunner(), |
| 187 test_helper_->GetMojoIpcToken(), | 187 test_helper_->GetMojoIpcToken(), |
| 188 test_helper_->GetMojoApplicationToken()), | 188 test_helper_->GetMojoApplicationToken()), |
| 189 std::move(renderer_scheduler), test_task_counter); | 189 std::move(renderer_scheduler), test_task_counter); |
| 190 cmd->InitFromArgv(old_argv); | 190 cmd->InitFromArgv(old_argv); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 238 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
| 239 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 239 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
| 240 | 240 |
| 241 base::RunLoop().Run(); | 241 base::RunLoop().Run(); |
| 242 | 242 |
| 243 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 243 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace | 246 } // namespace |
| 247 } // namespace content | 247 } // namespace content |
| OLD | NEW |