| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 }; | 1467 }; |
| 1468 | 1468 |
| 1469 | 1469 |
| 1470 // Initialize a Win32 thread object. The thread has an invalid thread | 1470 // Initialize a Win32 thread object. The thread has an invalid thread |
| 1471 // handle until it is started. | 1471 // handle until it is started. |
| 1472 | 1472 |
| 1473 Thread::Thread(Isolate* isolate) | 1473 Thread::Thread(Isolate* isolate) |
| 1474 : ThreadHandle(ThreadHandle::INVALID), | 1474 : ThreadHandle(ThreadHandle::INVALID), |
| 1475 isolate_(isolate) { | 1475 isolate_(isolate) { |
| 1476 data_ = new PlatformData(kNoThread); | 1476 data_ = new PlatformData(kNoThread); |
| 1477 set_name("v8:<unknown>"); |
| 1478 } |
| 1479 |
| 1480 |
| 1481 Thread::Thread(Isolate* isolate, const char* name) |
| 1482 : ThreadHandle(ThreadHandle::INVALID), |
| 1483 isolate_(isolate) { |
| 1484 data_ = new PlatformData(kNoThread); |
| 1485 set_name(name); |
| 1486 } |
| 1487 |
| 1488 |
| 1489 void Thread::set_name(const char* name) { |
| 1490 strncpy_s(name_, name, sizeof(name_)); |
| 1491 name_[sizeof(name_) - 1] = '\0'; |
| 1477 } | 1492 } |
| 1478 | 1493 |
| 1479 | 1494 |
| 1480 // Close our own handle for the thread. | 1495 // Close our own handle for the thread. |
| 1481 Thread::~Thread() { | 1496 Thread::~Thread() { |
| 1482 if (data_->thread_ != kNoThread) CloseHandle(data_->thread_); | 1497 if (data_->thread_ != kNoThread) CloseHandle(data_->thread_); |
| 1483 delete data_; | 1498 delete data_; |
| 1484 } | 1499 } |
| 1485 | 1500 |
| 1486 | 1501 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 | 1986 |
| 1972 void Sampler::Stop() { | 1987 void Sampler::Stop() { |
| 1973 ASSERT(IsActive()); | 1988 ASSERT(IsActive()); |
| 1974 SamplerThread::RemoveActiveSampler(this); | 1989 SamplerThread::RemoveActiveSampler(this); |
| 1975 SetActive(false); | 1990 SetActive(false); |
| 1976 } | 1991 } |
| 1977 | 1992 |
| 1978 #endif // ENABLE_LOGGING_AND_PROFILING | 1993 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1979 | 1994 |
| 1980 } } // namespace v8::internal | 1995 } } // namespace v8::internal |
| OLD | NEW |