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

Unified Diff: runtime/vm/os_thread_win.cc

Issue 796063006: Rename Thread -> OSThread. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_thread_win.h ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread_win.cc
===================================================================
--- runtime/vm/os_thread_win.cc (revision 42873)
+++ runtime/vm/os_thread_win.cc (working copy)
@@ -2,10 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#include "platform/globals.h"
+#include "platform/globals.h" // NOLINT
#if defined(TARGET_OS_WINDOWS)
-#include "vm/thread.h"
+#include "vm/os_thread.h"
#include <process.h> // NOLINT
@@ -16,14 +16,14 @@
class ThreadStartData {
public:
- ThreadStartData(Thread::ThreadStartFunction function, uword parameter)
+ ThreadStartData(OSThread::ThreadStartFunction function, uword parameter)
: function_(function), parameter_(parameter) {}
- Thread::ThreadStartFunction function() const { return function_; }
+ OSThread::ThreadStartFunction function() const { return function_; }
uword parameter() const { return parameter_; }
private:
- Thread::ThreadStartFunction function_;
+ OSThread::ThreadStartFunction function_;
uword parameter_;
DISALLOW_COPY_AND_ASSIGN(ThreadStartData);
@@ -36,7 +36,7 @@
static unsigned int __stdcall ThreadEntry(void* data_ptr) {
ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr);
- Thread::ThreadStartFunction function = data->function();
+ OSThread::ThreadStartFunction function = data->function();
uword parameter = data->parameter();
delete data;
@@ -52,10 +52,10 @@
}
-int Thread::Start(ThreadStartFunction function, uword parameter) {
+int OSThread::Start(ThreadStartFunction function, uword parameter) {
ThreadStartData* start_data = new ThreadStartData(function, parameter);
uint32_t tid;
- uintptr_t thread = _beginthreadex(NULL, Thread::GetMaxStackSize(),
+ uintptr_t thread = _beginthreadex(NULL, OSThread::GetMaxStackSize(),
ThreadEntry, start_data, 0, &tid);
if (thread == -1L || thread == 0) {
#ifdef DEBUG
@@ -70,10 +70,10 @@
return 0;
}
-ThreadLocalKey Thread::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES;
-ThreadId Thread::kInvalidThreadId = 0;
+ThreadLocalKey OSThread::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES;
+ThreadId OSThread::kInvalidThreadId = 0;
-ThreadLocalKey Thread::CreateThreadLocal() {
+ThreadLocalKey OSThread::CreateThreadLocal() {
ThreadLocalKey key = TlsAlloc();
if (key == kUnsetThreadLocalKey) {
FATAL1("TlsAlloc failed %d", GetLastError());
@@ -82,7 +82,7 @@
}
-void Thread::DeleteThreadLocal(ThreadLocalKey key) {
+void OSThread::DeleteThreadLocal(ThreadLocalKey key) {
ASSERT(key != kUnsetThreadLocalKey);
BOOL result = TlsFree(key);
if (!result) {
@@ -91,18 +91,18 @@
}
-intptr_t Thread::GetMaxStackSize() {
+intptr_t OSThread::GetMaxStackSize() {
const int kStackSize = (128 * kWordSize * KB);
return kStackSize;
}
-ThreadId Thread::GetCurrentThreadId() {
+ThreadId OSThread::GetCurrentThreadId() {
return ::GetCurrentThreadId();
}
-bool Thread::Join(ThreadId id) {
+bool OSThread::Join(ThreadId id) {
HANDLE handle = OpenThread(SYNCHRONIZE, false, id);
if (handle == INVALID_HANDLE_VALUE) {
return false;
@@ -113,18 +113,18 @@
}
-intptr_t Thread::ThreadIdToIntPtr(ThreadId id) {
+intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
ASSERT(sizeof(id) <= sizeof(intptr_t));
return static_cast<intptr_t>(id);
}
-bool Thread::Compare(ThreadId a, ThreadId b) {
+bool OSThread::Compare(ThreadId a, ThreadId b) {
return a == b;
}
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
+void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
static const int64_t kTimeEpoc = 116444736000000000LL;
static const int64_t kTimeScaler = 10; // 100 ns to us.
// Although win32 uses 64-bit integers for representing timestamps,
@@ -156,7 +156,7 @@
}
-void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
+void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) {
ASSERT(key != kUnsetThreadLocalKey);
BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value));
if (!result) {
@@ -231,7 +231,7 @@
ThreadLocalKey MonitorWaitData::monitor_wait_data_key_ =
- Thread::kUnsetThreadLocalKey;
+ OSThread::kUnsetThreadLocalKey;
Monitor::Monitor() {
@@ -260,9 +260,9 @@
void MonitorWaitData::ThreadExit() {
if (MonitorWaitData::monitor_wait_data_key_ !=
- Thread::kUnsetThreadLocalKey) {
+ OSThread::kUnsetThreadLocalKey) {
uword raw_wait_data =
- Thread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_);
+ OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_);
if (raw_wait_data != 0) {
MonitorWaitData* wait_data =
reinterpret_cast<MonitorWaitData*>(raw_wait_data);
@@ -367,17 +367,17 @@
// Ensure that the thread local key for monitor wait data objects is
// initialized.
ASSERT(MonitorWaitData::monitor_wait_data_key_ !=
- Thread::kUnsetThreadLocalKey);
+ OSThread::kUnsetThreadLocalKey);
// Get the MonitorWaitData object containing the event for this
// thread from thread local storage. Create it if it does not exist.
uword raw_wait_data =
- Thread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_);
+ OSThread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_);
MonitorWaitData* wait_data = NULL;
if (raw_wait_data == 0) {
HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL);
wait_data = new MonitorWaitData(event);
- Thread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_,
+ OSThread::SetThreadLocal(MonitorWaitData::monitor_wait_data_key_,
reinterpret_cast<uword>(wait_data));
} else {
wait_data = reinterpret_cast<MonitorWaitData*>(raw_wait_data);
« no previous file with comments | « runtime/vm/os_thread_win.h ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698