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 struct Options { | 415 class Options { |
416 Options() : name("v8:<unknown>"), stack_size(0) {} | 416 public: |
| 417 Options() : name_("v8:<unknown>"), stack_size_(0) {} |
| 418 Options(const char* name, int stack_size = 0) |
| 419 : name_(name), stack_size_(stack_size) {} |
417 | 420 |
418 const char* name; | 421 const char* name() const { return name_; } |
419 int stack_size; | 422 int stack_size() const { return stack_size_; } |
| 423 |
| 424 private: |
| 425 const char* name_; |
| 426 int stack_size_; |
420 }; | 427 }; |
421 | 428 |
422 // Create new thread. | 429 // Create new thread. |
423 explicit Thread(const Options& options); | 430 explicit Thread(const Options& options); |
424 explicit Thread(const char* name); | |
425 virtual ~Thread(); | 431 virtual ~Thread(); |
426 | 432 |
427 // Start new thread by calling the Run() method in the new thread. | 433 // Start new thread by calling the Run() method in the new thread. |
428 void Start(); | 434 void Start(); |
429 | 435 |
430 // Wait until thread terminates. | 436 // Wait until thread terminates. |
431 void Join(); | 437 void Join(); |
432 | 438 |
433 inline const char* name() const { | 439 inline const char* name() const { |
434 return name_; | 440 return name_; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 Atomic32 active_; | 694 Atomic32 active_; |
689 PlatformData* data_; // Platform specific data. | 695 PlatformData* data_; // Platform specific data. |
690 int samples_taken_; // Counts stack samples taken. | 696 int samples_taken_; // Counts stack samples taken. |
691 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 697 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
692 }; | 698 }; |
693 | 699 |
694 | 700 |
695 } } // namespace v8::internal | 701 } } // namespace v8::internal |
696 | 702 |
697 #endif // V8_PLATFORM_H_ | 703 #endif // V8_PLATFORM_H_ |
OLD | NEW |