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

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

Issue 977573002: content: Add an overridable task runner to ChildThreadImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move GetTaskRunner back to the RenderThread. Created 5 years, 9 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/public/child/child_thread.h ('k') | content/renderer/render_thread_impl.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/in_process_renderer_thread.h" 5 #include "content/renderer/in_process_renderer_thread.h"
6 6
7 #include "content/renderer/render_process.h" 7 #include "content/renderer/render_process.h"
8 #include "content/renderer/render_process_impl.h" 8 #include "content/renderer/render_process_impl.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "content/renderer/scheduler/renderer_scheduler.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 InProcessRendererThread::InProcessRendererThread(const std::string& channel_id) 14 InProcessRendererThread::InProcessRendererThread(const std::string& channel_id)
14 : Thread("Chrome_InProcRendererThread"), channel_id_(channel_id) { 15 : Thread("Chrome_InProcRendererThread"), channel_id_(channel_id) {
15 } 16 }
16 17
17 InProcessRendererThread::~InProcessRendererThread() { 18 InProcessRendererThread::~InProcessRendererThread() {
18 Stop(); 19 Stop();
19 } 20 }
20 21
21 void InProcessRendererThread::Init() { 22 void InProcessRendererThread::Init() {
22 render_process_.reset(new RenderProcessImpl()); 23 render_process_.reset(new RenderProcessImpl());
23 new RenderThreadImpl(channel_id_); 24 scoped_ptr<RendererScheduler> renderer_scheduler =
25 RendererScheduler::Create();
26 new RenderThreadImpl(channel_id_, renderer_scheduler.Pass());
24 } 27 }
25 28
26 void InProcessRendererThread::CleanUp() { 29 void InProcessRendererThread::CleanUp() {
27 render_process_.reset(); 30 render_process_.reset();
28 31
29 // It's a little lame to manually set this flag. But the single process 32 // It's a little lame to manually set this flag. But the single process
30 // RendererThread will receive the WM_QUIT. We don't need to assert on 33 // RendererThread will receive the WM_QUIT. We don't need to assert on
31 // this thread, so just force the flag manually. 34 // this thread, so just force the flag manually.
32 // If we want to avoid this, we could create the InProcRendererThread 35 // If we want to avoid this, we could create the InProcRendererThread
33 // directly with _beginthreadex() rather than using the Thread class. 36 // directly with _beginthreadex() rather than using the Thread class.
34 // We used to set this flag in the Init function above. However there 37 // We used to set this flag in the Init function above. However there
35 // other threads like WebThread which are created by this thread 38 // other threads like WebThread which are created by this thread
36 // which resets this flag. Please see Thread::StartWithOptions. Setting 39 // which resets this flag. Please see Thread::StartWithOptions. Setting
37 // this flag to true in Cleanup works around these problems. 40 // this flag to true in Cleanup works around these problems.
38 SetThreadWasQuitProperly(true); 41 SetThreadWasQuitProperly(true);
39 } 42 }
40 43
41 base::Thread* CreateInProcessRendererThread(const std::string& channel_id) { 44 base::Thread* CreateInProcessRendererThread(const std::string& channel_id) {
42 return new InProcessRendererThread(channel_id); 45 return new InProcessRendererThread(channel_id);
43 } 46 }
44 47
45 } // namespace content 48 } // namespace content
OLDNEW
« no previous file with comments | « content/public/child/child_thread.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698