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

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

Issue 8965072: Add function support for Sleep and MessageLoop with TimeDelta input. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comment spacing. Created 8 years, 12 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_posix.cc ('k') | base/threading/thread_unittest.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void PlatformThread::YieldCurrentThread() { 107 void PlatformThread::YieldCurrentThread() {
108 ::Sleep(0); 108 ::Sleep(0);
109 } 109 }
110 110
111 // static 111 // static
112 void PlatformThread::Sleep(int duration_ms) { 112 void PlatformThread::Sleep(int duration_ms) {
113 ::Sleep(duration_ms); 113 ::Sleep(duration_ms);
114 } 114 }
115 115
116 // static 116 // static
117 void PlatformThread::Sleep(TimeDelta duration) {
118 ::Sleep(duration.InMillisecondsRoundedUp());
119 }
120
121 // static
117 void PlatformThread::SetName(const char* name) { 122 void PlatformThread::SetName(const char* name) {
118 current_thread_name.Set(const_cast<char*>(name)); 123 current_thread_name.Set(const_cast<char*>(name));
119 tracked_objects::ThreadData::InitializeThreadContext(name); 124 tracked_objects::ThreadData::InitializeThreadContext(name);
120 125
121 // The debugger needs to be around to catch the name in the exception. If 126 // The debugger needs to be around to catch the name in the exception. If
122 // there isn't a debugger, we are just needlessly throwing an exception. 127 // there isn't a debugger, we are just needlessly throwing an exception.
123 if (!::IsDebuggerPresent()) 128 if (!::IsDebuggerPresent())
124 return; 129 return;
125 130
126 SetNameInternal(CurrentId(), name); 131 SetNameInternal(CurrentId(), name);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 case kThreadPriority_RealtimeAudio: 178 case kThreadPriority_RealtimeAudio:
174 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); 179 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
175 break; 180 break;
176 default: 181 default:
177 NOTIMPLEMENTED(); 182 NOTIMPLEMENTED();
178 break; 183 break;
179 } 184 }
180 } 185 }
181 186
182 } // namespace base 187 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | base/threading/thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698