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

Side by Side Diff: runtime/vm/thread.h

Issue 1406413006: Timeline service protocol support with Observatory UI (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/handles.h" 9 #include "vm/handles.h"
10 #include "vm/os_thread.h" 10 #include "vm/os_thread.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 ThreadId id() const { 356 ThreadId id() const {
357 ASSERT(id_ != OSThread::kInvalidThreadId); 357 ASSERT(id_ != OSThread::kInvalidThreadId);
358 return id_; 358 return id_;
359 } 359 }
360 360
361 ThreadId join_id() const { 361 ThreadId join_id() const {
362 ASSERT(join_id_ != OSThread::kInvalidThreadJoinId); 362 ASSERT(join_id_ != OSThread::kInvalidThreadJoinId);
363 return join_id_; 363 return join_id_;
364 } 364 }
365 365
366 ThreadId trace_id() const {
367 ASSERT(trace_id_ != OSThread::kInvalidThreadJoinId);
368 return trace_id_;
369 }
370
371 const char* name() const {
372 return name_;
373 }
374
375 void set_name(const char* name) {
376 ASSERT(Thread::Current() == this);
377 ASSERT(name_ == NULL);
378 name_ = name;
379 }
380
366 // Used to temporarily disable or enable thread interrupts. 381 // Used to temporarily disable or enable thread interrupts.
367 void DisableThreadInterrupts(); 382 void DisableThreadInterrupts();
368 void EnableThreadInterrupts(); 383 void EnableThreadInterrupts();
369 bool ThreadInterruptsEnabled(); 384 bool ThreadInterruptsEnabled();
370 385
371 #if defined(DEBUG) 386 #if defined(DEBUG)
372 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ 387 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
373 void set_reusable_##object##_handle_scope_active(bool value) { \ 388 void set_reusable_##object##_handle_scope_active(bool value) { \
374 reusable_##object##_handle_scope_active_ = value; \ 389 reusable_##object##_handle_scope_active_ = value; \
375 } \ 390 } \
(...skipping 27 matching lines...) Expand all
403 418
404 static bool IsThreadInList(ThreadId join_id); 419 static bool IsThreadInList(ThreadId join_id);
405 420
406 private: 421 private:
407 template<class T> T* AllocateReusableHandle(); 422 template<class T> T* AllocateReusableHandle();
408 423
409 static ThreadLocalKey thread_key_; 424 static ThreadLocalKey thread_key_;
410 425
411 const ThreadId id_; 426 const ThreadId id_;
412 const ThreadId join_id_; 427 const ThreadId join_id_;
428 const ThreadId trace_id_;
413 uintptr_t thread_interrupt_disabled_; 429 uintptr_t thread_interrupt_disabled_;
414 Isolate* isolate_; 430 Isolate* isolate_;
415 Heap* heap_; 431 Heap* heap_;
416 State state_; 432 State state_;
417 Mutex timeline_block_lock_; 433 Mutex timeline_block_lock_;
418 TimelineEventBlock* timeline_block_; 434 TimelineEventBlock* timeline_block_;
419 StoreBufferBlock* store_buffer_block_; 435 StoreBufferBlock* store_buffer_block_;
420 class Log* log_; 436 class Log* log_;
421 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 437 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
422 type_name member_name; 438 type_name member_name;
(...skipping 29 matching lines...) Expand all
452 CHA* cha_; 468 CHA* cha_;
453 intptr_t deopt_id_; // Compilation specific counter. 469 intptr_t deopt_id_; // Compilation specific counter.
454 uword vm_tag_; 470 uword vm_tag_;
455 RawGrowableObjectArray* pending_functions_; 471 RawGrowableObjectArray* pending_functions_;
456 472
457 int32_t no_callback_scope_depth_; 473 int32_t no_callback_scope_depth_;
458 474
459 // All |Thread|s are registered in the thread list. 475 // All |Thread|s are registered in the thread list.
460 Thread* thread_list_next_; 476 Thread* thread_list_next_;
461 477
478 // A name for this thread.
479 const char* name_;
480
462 static Thread* thread_list_head_; 481 static Thread* thread_list_head_;
463 static Mutex* thread_list_lock_; 482 static Mutex* thread_list_lock_;
464 483
465 static void AddThreadToList(Thread* thread); 484 static void AddThreadToList(Thread* thread);
466 static void RemoveThreadFromList(Thread* thread); 485 static void RemoveThreadFromList(Thread* thread);
467 486
468 explicit Thread(bool init_vm_constants = true); 487 explicit Thread(bool init_vm_constants = true);
469 488
470 void InitVMConstants(); 489 void InitVMConstants();
471 490
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // Disable thread interrupts. 550 // Disable thread interrupts.
532 class DisableThreadInterruptsScope : public StackResource { 551 class DisableThreadInterruptsScope : public StackResource {
533 public: 552 public:
534 explicit DisableThreadInterruptsScope(Thread* thread); 553 explicit DisableThreadInterruptsScope(Thread* thread);
535 ~DisableThreadInterruptsScope(); 554 ~DisableThreadInterruptsScope();
536 }; 555 };
537 556
538 } // namespace dart 557 } // namespace dart
539 558
540 #endif // VM_THREAD_H_ 559 #endif // VM_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698