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

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

Issue 1900513003: Try to diagnose blink reinitialisation in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it actually compile (missing headers) Created 4 years, 8 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 | « no previous file | content/renderer/render_thread_impl.cc » ('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 "base/command_line.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/public/common/content_switches.h"
8 #include "content/renderer/render_process.h" 10 #include "content/renderer/render_process.h"
9 #include "content/renderer/render_process_impl.h" 11 #include "content/renderer/render_process_impl.h"
10 #include "content/renderer/render_thread_impl.h" 12 #include "content/renderer/render_thread_impl.h"
11 13
12 #if defined(OS_ANDROID) 14 #if defined(OS_ANDROID)
13 #include "base/android/jni_android.h" 15 #include "base/android/jni_android.h"
14 #endif 16 #endif
15 17
16 namespace content { 18 namespace content {
17 19
18 InProcessRendererThread::InProcessRendererThread( 20 InProcessRendererThread::InProcessRendererThread(
19 const InProcessChildThreadParams& params) 21 const InProcessChildThreadParams& params)
20 : Thread("Chrome_InProcRendererThread"), params_(params) { 22 : Thread("Chrome_InProcRendererThread"), params_(params) {
21 } 23 }
22 24
23 InProcessRendererThread::~InProcessRendererThread() { 25 InProcessRendererThread::~InProcessRendererThread() {
26 #if defined(OS_ANDROID)
27 // Don't allow the render thread to be shut down in single process mode on
28 // Android. Temporary CHECK() to debug http://crbug.com/514141
29 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
johnme 2016/04/19 14:25:10 This check triggers frequently in content_browsert
30 switches::kSingleProcess));
31 #endif
32
24 Stop(); 33 Stop();
25 } 34 }
26 35
27 void InProcessRendererThread::Init() { 36 void InProcessRendererThread::Init() {
28 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread() 37 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread()
29 // calls. The latter causes Java VM to assign Thread-??? to the thread name. 38 // calls. The latter causes Java VM to assign Thread-??? to the thread name.
30 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread 39 // Please note calls to AttachCurrentThreadWithName after AttachCurrentThread
31 // will not change the thread name kept in Java VM. 40 // will not change the thread name kept in Java VM.
32 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
33 base::android::AttachCurrentThreadWithName(thread_name()); 42 base::android::AttachCurrentThreadWithName(thread_name());
43 // Make sure we aren't somehow reinitialising the inprocess renderer thread on
44 // Android. Temporary CHECK() to debug http://crbug.com/514141
45 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
46 switches::kSingleProcess) || !render_process_);
34 #endif 47 #endif
35 render_process_.reset(new RenderProcessImpl()); 48 render_process_.reset(new RenderProcessImpl());
36 RenderThreadImpl::Create(params_); 49 RenderThreadImpl::Create(params_);
37 } 50 }
38 51
39 void InProcessRendererThread::CleanUp() { 52 void InProcessRendererThread::CleanUp() {
53 #if defined(OS_ANDROID)
54 // Don't allow the render thread to be shut down in single process mode on
55 // Android. Temporary CHECK() to debug http://crbug.com/514141
56 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
57 switches::kSingleProcess));
58 #endif
59
40 render_process_.reset(); 60 render_process_.reset();
41 61
42 // It's a little lame to manually set this flag. But the single process 62 // It's a little lame to manually set this flag. But the single process
43 // RendererThread will receive the WM_QUIT. We don't need to assert on 63 // RendererThread will receive the WM_QUIT. We don't need to assert on
44 // this thread, so just force the flag manually. 64 // this thread, so just force the flag manually.
45 // If we want to avoid this, we could create the InProcRendererThread 65 // If we want to avoid this, we could create the InProcRendererThread
46 // directly with _beginthreadex() rather than using the Thread class. 66 // directly with _beginthreadex() rather than using the Thread class.
47 // We used to set this flag in the Init function above. However there 67 // We used to set this flag in the Init function above. However there
48 // other threads like WebThread which are created by this thread 68 // other threads like WebThread which are created by this thread
49 // which resets this flag. Please see Thread::StartWithOptions. Setting 69 // which resets this flag. Please see Thread::StartWithOptions. Setting
50 // this flag to true in Cleanup works around these problems. 70 // this flag to true in Cleanup works around these problems.
51 SetThreadWasQuitProperly(true); 71 SetThreadWasQuitProperly(true);
52 } 72 }
53 73
54 base::Thread* CreateInProcessRendererThread( 74 base::Thread* CreateInProcessRendererThread(
55 const InProcessChildThreadParams& params) { 75 const InProcessChildThreadParams& params) {
56 return new InProcessRendererThread(params); 76 return new InProcessRendererThread(params);
57 } 77 }
58 78
59 } // namespace content 79 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698