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

Side by Side Diff: src/platform.h

Issue 7003108: "Deiceolate" Thread classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt 377 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
378 }; 378 };
379 379
380 struct Options { 380 struct Options {
381 Options() : name("v8:<unknown>"), stack_size(0) {} 381 Options() : name("v8:<unknown>"), stack_size(0) {}
382 382
383 const char* name; 383 const char* name;
384 int stack_size; 384 int stack_size;
385 }; 385 };
386 386
387 // Create new thread (with a value for storing in the TLS isolate field). 387 // Create new thread.
388 Thread(Isolate* isolate, const Options& options); 388 explicit Thread(const Options& options);
389 Thread(Isolate* isolate, const char* name); 389 explicit Thread(const char* name);
390 virtual ~Thread(); 390 virtual ~Thread();
391 391
392 // Start new thread by calling the Run() method in the new thread. 392 // Start new thread by calling the Run() method in the new thread.
393 void Start(); 393 void Start();
394 394
395 // Wait until thread terminates. 395 // Wait until thread terminates.
396 void Join(); 396 void Join();
397 397
398 inline const char* name() const { 398 inline const char* name() const {
399 return name_; 399 return name_;
(...skipping 26 matching lines...) Expand all
426 } 426 }
427 #else 427 #else
428 static inline void* GetExistingThreadLocal(LocalStorageKey key) { 428 static inline void* GetExistingThreadLocal(LocalStorageKey key) {
429 return GetThreadLocal(key); 429 return GetThreadLocal(key);
430 } 430 }
431 #endif 431 #endif
432 432
433 // A hint to the scheduler to let another thread run. 433 // A hint to the scheduler to let another thread run.
434 static void YieldCPU(); 434 static void YieldCPU();
435 435
436 Isolate* isolate() const { return isolate_; }
437 436
438 // The thread name length is limited to 16 based on Linux's implementation of 437 // The thread name length is limited to 16 based on Linux's implementation of
439 // prctl(). 438 // prctl().
440 static const int kMaxThreadNameLength = 16; 439 static const int kMaxThreadNameLength = 16;
441 440
442 class PlatformData; 441 class PlatformData;
443 PlatformData* data() { return data_; } 442 PlatformData* data() { return data_; }
444 443
445 private: 444 private:
446 void set_name(const char *name); 445 void set_name(const char *name);
447 446
448 PlatformData* data_; 447 PlatformData* data_;
449 448
450 Isolate* isolate_;
451 char name_[kMaxThreadNameLength]; 449 char name_[kMaxThreadNameLength];
452 int stack_size_; 450 int stack_size_;
453 451
454 DISALLOW_COPY_AND_ASSIGN(Thread); 452 DISALLOW_COPY_AND_ASSIGN(Thread);
455 }; 453 };
456 454
457 455
458 // ---------------------------------------------------------------------------- 456 // ----------------------------------------------------------------------------
459 // Mutex 457 // Mutex
460 // 458 //
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 int samples_taken_; // Counts stack samples taken. 656 int samples_taken_; // Counts stack samples taken.
659 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 657 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
660 }; 658 };
661 659
662 660
663 #endif // ENABLE_LOGGING_AND_PROFILING 661 #endif // ENABLE_LOGGING_AND_PROFILING
664 662
665 } } // namespace v8::internal 663 } } // namespace v8::internal
666 664
667 #endif // V8_PLATFORM_H_ 665 #endif // V8_PLATFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698