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

Side by Side Diff: content/browser/browser_thread_impl.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to head, address jyasskin's comments. Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/browser_thread_impl.h" 5 #include "content/browser/browser_thread_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } // namespace 63 } // namespace
64 64
65 BrowserThreadImpl::BrowserThreadImpl(ID identifier) 65 BrowserThreadImpl::BrowserThreadImpl(ID identifier)
66 : Thread(g_browser_thread_names[identifier]), 66 : Thread(g_browser_thread_names[identifier]),
67 identifier_(identifier) { 67 identifier_(identifier) {
68 Initialize(); 68 Initialize();
69 } 69 }
70 70
71 BrowserThreadImpl::BrowserThreadImpl(ID identifier, 71 BrowserThreadImpl::BrowserThreadImpl(ID identifier,
72 base::MessageLoop* message_loop) 72 base::MessageLoop* message_loop)
73 : Thread(message_loop->thread_name().c_str()), identifier_(identifier) { 73 : Thread(message_loop ? message_loop->thread_name().c_str() :
jam 2013/05/31 17:29:25 it seems odd using this constructor and passing in
awong 2013/05/31 20:57:17 I considered that initially, but I think this is c
jam 2013/05/31 22:53:04 I really don't like having two ways of doing the s
awong 2013/06/05 00:18:48 I'm trying to imagine a situation when someone cou
74 set_message_loop(message_loop); 74 g_browser_thread_names[identifier]),
75 identifier_(identifier) {
76 if (message_loop)
77 set_message_loop(message_loop);
75 Initialize(); 78 Initialize();
76 } 79 }
77 80
78 // static 81 // static
79 void BrowserThreadImpl::ShutdownThreadPool() { 82 void BrowserThreadImpl::ShutdownThreadPool() {
80 // The goal is to make it impossible for chrome to 'infinite loop' during 83 // The goal is to make it impossible for chrome to 'infinite loop' during
81 // shutdown, but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued 84 // shutdown, but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued
82 // during shutdown get run. There's nothing particularly scientific about the 85 // during shutdown get run. There's nothing particularly scientific about the
83 // number chosen. 86 // number chosen.
84 const int kMaxNewShutdownBlockingTasks = 1000; 87 const int kMaxNewShutdownBlockingTasks = 1000;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 480 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
478 &globals.thread_delegates[identifier]); 481 &globals.thread_delegates[identifier]);
479 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 482 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
480 storage, reinterpret_cast<AtomicWord>(delegate)); 483 storage, reinterpret_cast<AtomicWord>(delegate));
481 484
482 // This catches registration when previously registered. 485 // This catches registration when previously registered.
483 DCHECK(!delegate || !old_pointer); 486 DCHECK(!delegate || !old_pointer);
484 } 487 }
485 488
486 } // namespace content 489 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698