| 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/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 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 InProcessRendererThread::InProcessRendererThread( | 13 InProcessRendererThread::InProcessRendererThread( |
| 14 const InProcessChildThreadParams& params) | 14 const InProcessChildThreadParams& params) |
| 15 : Thread("Chrome_InProcRendererThread"), params_(params) { | 15 : Thread("Chrome_InProcRendererThread"), params_(params) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 InProcessRendererThread::~InProcessRendererThread() { | 18 InProcessRendererThread::~InProcessRendererThread() { |
| 19 Stop(); | 19 Stop(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void InProcessRendererThread::Init() { | 22 void InProcessRendererThread::Init() { |
| 23 render_process_.reset(new RenderProcessImpl()); | 23 render_process_.reset(new RenderProcessImpl()); |
| 24 new RenderThreadImpl(params_); | 24 RenderThreadImpl::Create(params_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void InProcessRendererThread::CleanUp() { | 27 void InProcessRendererThread::CleanUp() { |
| 28 render_process_.reset(); | 28 render_process_.reset(); |
| 29 | 29 |
| 30 // It's a little lame to manually set this flag. But the single process | 30 // It's a little lame to manually set this flag. But the single process |
| 31 // RendererThread will receive the WM_QUIT. We don't need to assert on | 31 // RendererThread will receive the WM_QUIT. We don't need to assert on |
| 32 // this thread, so just force the flag manually. | 32 // this thread, so just force the flag manually. |
| 33 // If we want to avoid this, we could create the InProcRendererThread | 33 // If we want to avoid this, we could create the InProcRendererThread |
| 34 // directly with _beginthreadex() rather than using the Thread class. | 34 // directly with _beginthreadex() rather than using the Thread class. |
| 35 // We used to set this flag in the Init function above. However there | 35 // We used to set this flag in the Init function above. However there |
| 36 // other threads like WebThread which are created by this thread | 36 // other threads like WebThread which are created by this thread |
| 37 // which resets this flag. Please see Thread::StartWithOptions. Setting | 37 // which resets this flag. Please see Thread::StartWithOptions. Setting |
| 38 // this flag to true in Cleanup works around these problems. | 38 // this flag to true in Cleanup works around these problems. |
| 39 SetThreadWasQuitProperly(true); | 39 SetThreadWasQuitProperly(true); |
| 40 } | 40 } |
| 41 | 41 |
| 42 base::Thread* CreateInProcessRendererThread( | 42 base::Thread* CreateInProcessRendererThread( |
| 43 const InProcessChildThreadParams& params) { | 43 const InProcessChildThreadParams& params) { |
| 44 return new InProcessRendererThread(params); | 44 return new InProcessRendererThread(params); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace content | 47 } // namespace content |
| OLD | NEW |