Update .DEPS.git
[chromium-blink-merge.git] / content / renderer / in_process_renderer_thread.cc
blobfa6b834b1761ee1b1a91c87d9c04683a4439d7a4
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
3 // found in the LICENSE file.
5 #include "content/renderer/in_process_renderer_thread.h"
7 #include "content/renderer/render_process.h"
8 #include "content/renderer/render_process_impl.h"
9 #include "content/renderer/render_thread_impl.h"
11 namespace content {
13 InProcessRendererThread::InProcessRendererThread(const std::string& channel_id)
14 : Thread("Chrome_InProcRendererThread"), channel_id_(channel_id) {
17 InProcessRendererThread::~InProcessRendererThread() {
18 Stop();
21 void InProcessRendererThread::Init() {
22 render_process_.reset(new RenderProcessImpl());
23 new RenderThreadImpl(channel_id_);
26 void InProcessRendererThread::CleanUp() {
27 render_process_.reset();
29 // 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
31 // this thread, so just force the flag manually.
32 // If we want to avoid this, we could create the InProcRendererThread
33 // directly with _beginthreadex() rather than using the Thread class.
34 // We used to set this flag in the Init function above. However there
35 // other threads like WebThread which are created by this thread
36 // which resets this flag. Please see Thread::StartWithOptions. Setting
37 // this flag to true in Cleanup works around these problems.
38 SetThreadWasQuitProperly(true);
41 base::Thread* CreateInProcessRendererThread(const std::string& channel_id) {
42 return new InProcessRendererThread(channel_id);
45 } // namespace content