| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/web/web_thread_impl.h" | 5 #include "ios/web/web_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 } // namespace | 120 } // namespace |
| 121 | 121 |
| 122 WebThreadImpl::WebThreadImpl(ID identifier) | 122 WebThreadImpl::WebThreadImpl(ID identifier) |
| 123 : Thread(GetThreadName(identifier)), identifier_(identifier) { | 123 : Thread(GetThreadName(identifier)), identifier_(identifier) { |
| 124 Initialize(); | 124 Initialize(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 WebThreadImpl::WebThreadImpl(ID identifier, base::MessageLoop* message_loop) | 127 WebThreadImpl::WebThreadImpl(ID identifier, base::MessageLoop* message_loop) |
| 128 : Thread(GetThreadName(identifier)), identifier_(identifier) { | 128 : Thread(GetThreadName(identifier)), identifier_(identifier) { |
| 129 set_message_loop(message_loop); | 129 SetMessageLoop(message_loop); |
| 130 Initialize(); | 130 Initialize(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // static | 133 // static |
| 134 void WebThreadImpl::ShutdownThreadPool() { | 134 void WebThreadImpl::ShutdownThreadPool() { |
| 135 // The goal is to make it impossible to 'infinite loop' during shutdown, | 135 // The goal is to make it impossible to 'infinite loop' during shutdown, |
| 136 // but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued during | 136 // but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued during |
| 137 // shutdown get run. There's nothing particularly scientific about the | 137 // shutdown get run. There's nothing particularly scientific about the |
| 138 // number chosen. | 138 // number chosen. |
| 139 const int kMaxNewShutdownBlockingTasks = 1000; | 139 const int kMaxNewShutdownBlockingTasks = 1000; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 AtomicWord* storage = | 499 AtomicWord* storage = |
| 500 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); | 500 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); |
| 501 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 501 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
| 502 storage, reinterpret_cast<AtomicWord>(delegate)); | 502 storage, reinterpret_cast<AtomicWord>(delegate)); |
| 503 | 503 |
| 504 // This catches registration when previously registered. | 504 // This catches registration when previously registered. |
| 505 DCHECK(!delegate || !old_pointer); | 505 DCHECK(!delegate || !old_pointer); |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace web | 508 } // namespace web |
| OLD | NEW |