OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 public: | 405 public: |
406 // Opaque data type for thread-local storage keys. | 406 // Opaque data type for thread-local storage keys. |
407 // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified | 407 // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified |
408 // to ensure that enumeration type has correct value range (see Issue 830 for | 408 // to ensure that enumeration type has correct value range (see Issue 830 for |
409 // more details). | 409 // more details). |
410 enum LocalStorageKey { | 410 enum LocalStorageKey { |
411 LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt, | 411 LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt, |
412 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt | 412 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt |
413 }; | 413 }; |
414 | 414 |
415 class Options { | 415 struct Options { |
416 public: | 416 Options() : name("v8:<unknown>"), stack_size(0) {} |
417 Options() : name_("v8:<unknown>"), stack_size_(0) {} | |
418 Options(const char* name, int stack_size = 0) | |
419 : name_(name), stack_size_(stack_size) {} | |
420 | 417 |
421 const char* name() const { return name_; } | 418 const char* name; |
422 int stack_size() const { return stack_size_; } | 419 int stack_size; |
423 | |
424 private: | |
425 const char* name_; | |
426 int stack_size_; | |
427 }; | 420 }; |
428 | 421 |
429 // Create new thread. | 422 // Create new thread. |
430 explicit Thread(const Options& options); | 423 explicit Thread(const Options& options); |
| 424 explicit Thread(const char* name); |
431 virtual ~Thread(); | 425 virtual ~Thread(); |
432 | 426 |
433 // Start new thread by calling the Run() method in the new thread. | 427 // Start new thread by calling the Run() method in the new thread. |
434 void Start(); | 428 void Start(); |
435 | 429 |
436 // Wait until thread terminates. | 430 // Wait until thread terminates. |
437 void Join(); | 431 void Join(); |
438 | 432 |
439 inline const char* name() const { | 433 inline const char* name() const { |
440 return name_; | 434 return name_; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 Atomic32 active_; | 688 Atomic32 active_; |
695 PlatformData* data_; // Platform specific data. | 689 PlatformData* data_; // Platform specific data. |
696 int samples_taken_; // Counts stack samples taken. | 690 int samples_taken_; // Counts stack samples taken. |
697 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 691 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
698 }; | 692 }; |
699 | 693 |
700 | 694 |
701 } } // namespace v8::internal | 695 } } // namespace v8::internal |
702 | 696 |
703 #endif // V8_PLATFORM_H_ | 697 #endif // V8_PLATFORM_H_ |
OLD | NEW |