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

Side by Side Diff: base/threading/platform_thread_win.cc

Issue 1140363002: Revert of Reland: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « base/threading/platform_thread.h ('k') | base/threading/thread.h » ('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 (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 "base/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
8 #include "base/debug/profiler.h" 8 #include "base/debug/profiler.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_id_name_manager.h" 10 #include "base/threading/thread_id_name_manager.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 ThreadParams* params = new ThreadParams; 102 ThreadParams* params = new ThreadParams;
103 params->delegate = delegate; 103 params->delegate = delegate;
104 params->joinable = out_thread_handle != NULL; 104 params->joinable = out_thread_handle != NULL;
105 105
106 // Using CreateThread here vs _beginthreadex makes thread creation a bit 106 // Using CreateThread here vs _beginthreadex makes thread creation a bit
107 // faster and doesn't require the loader lock to be available. Our code will 107 // faster and doesn't require the loader lock to be available. Our code will
108 // have to work running on CreateThread() threads anyway, since we run code 108 // have to work running on CreateThread() threads anyway, since we run code
109 // on the Windows thread pool, etc. For some background on the difference: 109 // on the Windows thread pool, etc. For some background on the difference:
110 // http://www.microsoft.com/msj/1099/win32/win321099.aspx 110 // http://www.microsoft.com/msj/1099/win32/win321099.aspx
111 PlatformThreadId thread_id;
112 void* thread_handle = CreateThread( 111 void* thread_handle = CreateThread(
113 NULL, stack_size, ThreadFunc, params, flags, &thread_id); 112 NULL, stack_size, ThreadFunc, params, flags, NULL);
114 if (!thread_handle) { 113 if (!thread_handle) {
115 delete params; 114 delete params;
116 return false; 115 return false;
117 } 116 }
118 117
119 if (out_thread_handle) 118 if (out_thread_handle)
120 *out_thread_handle = PlatformThreadHandle(thread_handle, thread_id); 119 *out_thread_handle = PlatformThreadHandle(thread_handle);
121 else 120 else
122 CloseHandle(thread_handle); 121 CloseHandle(thread_handle);
123 return true; 122 return true;
124 } 123 }
125 124
126 } // namespace 125 } // namespace
127 126
128 // static 127 // static
129 PlatformThreadId PlatformThread::CurrentId() { 128 PlatformThreadId PlatformThread::CurrentId() {
130 return ::GetCurrentThreadId(); 129 return ::GetCurrentThreadId();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 return ThreadPriority::REALTIME_AUDIO; 279 return ThreadPriority::REALTIME_AUDIO;
281 case THREAD_PRIORITY_ERROR_RETURN: 280 case THREAD_PRIORITY_ERROR_RETURN:
282 DPCHECK(false) << "GetThreadPriority error"; // Falls through. 281 DPCHECK(false) << "GetThreadPriority error"; // Falls through.
283 default: 282 default:
284 NOTREACHED() << "Unexpected priority: " << priority; 283 NOTREACHED() << "Unexpected priority: " << priority;
285 return ThreadPriority::NORMAL; 284 return ThreadPriority::NORMAL;
286 } 285 }
287 } 286 }
288 287
289 } // namespace base 288 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread.h ('k') | base/threading/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698