Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/renderer/render_thread_impl_browsertest.cc

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/output/buffer_to_texture_target_map.h"
20 #include "components/scheduler/renderer/renderer_scheduler.h"
21 #include "content/app/mojo/mojo_init.h" 20 #include "content/app/mojo/mojo_init.h"
22 #include "content/common/in_process_child_thread_params.h" 21 #include "content/common/in_process_child_thread_params.h"
23 #include "content/common/resource_messages.h" 22 #include "content/common/resource_messages.h"
24 #include "content/common/websocket_messages.h" 23 #include "content/common/websocket_messages.h"
25 #include "content/public/browser/content_browser_client.h" 24 #include "content/public/browser/content_browser_client.h"
26 #include "content/public/common/content_client.h" 25 #include "content/public/common/content_client.h"
27 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
28 #include "content/public/renderer/content_renderer_client.h" 27 #include "content/public/renderer/content_renderer_client.h"
29 #include "content/renderer/render_process_impl.h" 28 #include "content/renderer/render_process_impl.h"
30 #include "content/test/mock_render_process.h" 29 #include "content/test/mock_render_process.h"
31 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" 30 #include "content/test/render_thread_impl_browser_test_ipc_helper.h"
32 #include "gpu/GLES2/gl2extchromium.h" 31 #include "gpu/GLES2/gl2extchromium.h"
33 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
34 34
35 // IPC messages for testing ---------------------------------------------------- 35 // IPC messages for testing ----------------------------------------------------
36 36
37 // TODO(mdempsky): Fix properly by moving into a separate 37 // TODO(mdempsky): Fix properly by moving into a separate
38 // browsertest_message_generator.cc file. 38 // browsertest_message_generator.cc file.
39 #undef IPC_IPC_MESSAGE_MACROS_H_ 39 #undef IPC_IPC_MESSAGE_MACROS_H_
40 #undef IPC_MESSAGE_EXTRA 40 #undef IPC_MESSAGE_EXTRA
41 #define IPC_MESSAGE_IMPL 41 #define IPC_MESSAGE_IMPL
42 #include "ipc/ipc_message_macros.h" 42 #include "ipc/ipc_message_macros.h"
43 #include "ipc/ipc_message_templates_impl.h" 43 #include "ipc/ipc_message_templates_impl.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #if defined(COMPILER_MSVC) 98 #if defined(COMPILER_MSVC)
99 // See explanation for other RenderViewHostImpl which is the same issue. 99 // See explanation for other RenderViewHostImpl which is the same issue.
100 #pragma warning(push) 100 #pragma warning(push)
101 #pragma warning(disable: 4250) 101 #pragma warning(disable: 4250)
102 #endif 102 #endif
103 103
104 class RenderThreadImplForTest : public RenderThreadImpl { 104 class RenderThreadImplForTest : public RenderThreadImpl {
105 public: 105 public:
106 RenderThreadImplForTest( 106 RenderThreadImplForTest(
107 const InProcessChildThreadParams& params, 107 const InProcessChildThreadParams& params,
108 std::unique_ptr<scheduler::RendererScheduler> scheduler, 108 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler,
109 scoped_refptr<base::SingleThreadTaskRunner>& test_task_counter) 109 scoped_refptr<base::SingleThreadTaskRunner>& test_task_counter)
110 : RenderThreadImpl(params, std::move(scheduler), test_task_counter) {} 110 : RenderThreadImpl(params, std::move(scheduler), test_task_counter) {}
111 111
112 ~RenderThreadImplForTest() override {} 112 ~RenderThreadImplForTest() override {}
113 113
114 using ChildThreadImpl::OnMessageReceived; 114 using ChildThreadImpl::OnMessageReceived;
115 115
116 private: 116 private:
117 }; 117 };
118 118
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // RenderThreadImpl expects the browser to pass these flags. 166 // RenderThreadImpl expects the browser to pass these flags.
167 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 167 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
168 base::CommandLine::StringVector old_argv = cmd->argv(); 168 base::CommandLine::StringVector old_argv = cmd->argv();
169 169
170 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); 170 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1");
171 cmd->AppendSwitchASCII( 171 cmd->AppendSwitchASCII(
172 switches::kContentImageTextureTarget, 172 switches::kContentImageTextureTarget,
173 cc::BufferToTextureTargetMapToString( 173 cc::BufferToTextureTargetMapToString(
174 cc::DefaultBufferToTextureTargetMapForTesting())); 174 cc::DefaultBufferToTextureTargetMapForTesting()));
175 175
176 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler = 176 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler =
177 scheduler::RendererScheduler::Create(); 177 blink::scheduler::RendererScheduler::Create();
178 InitializeMojo(); 178 InitializeMojo();
179 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter( 179 scoped_refptr<base::SingleThreadTaskRunner> test_task_counter(
180 test_task_counter_.get()); 180 test_task_counter_.get());
181 thread_ = new RenderThreadImplForTest( 181 thread_ = new RenderThreadImplForTest(
182 InProcessChildThreadParams(test_helper_->GetChannelId(), 182 InProcessChildThreadParams(test_helper_->GetChannelId(),
183 test_helper_->GetIOTaskRunner(), 183 test_helper_->GetIOTaskRunner(),
184 test_helper_->GetMojoIpcToken(), 184 test_helper_->GetMojoIpcToken(),
185 test_helper_->GetMojoApplicationToken()), 185 test_helper_->GetMojoApplicationToken()),
186 std::move(renderer_scheduler), test_task_counter); 186 std::move(renderer_scheduler), test_task_counter);
187 cmd->InitFromArgv(old_argv); 187 cmd->InitFromArgv(old_argv);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); 235 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, ""));
236 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); 236 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop());
237 237
238 base::RunLoop().Run(); 238 base::RunLoop().Run();
239 239
240 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); 240 EXPECT_EQ(0, test_task_counter_->NumTasksPosted());
241 } 241 }
242 242
243 } // namespace 243 } // namespace
244 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698