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

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

Issue 1475863002: Copy the passed in name string into the os_thread structure and delete it in the destructor. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | runtime/vm/os_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_OS_THREAD_H_ 5 #ifndef VM_OS_THREAD_H_
6 #define VM_OS_THREAD_H_ 6 #define VM_OS_THREAD_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return trace_id_; 68 return trace_id_;
69 } 69 }
70 70
71 const char* name() const { 71 const char* name() const {
72 return name_; 72 return name_;
73 } 73 }
74 74
75 void set_name(const char* name) { 75 void set_name(const char* name) {
76 ASSERT(OSThread::Current() == this); 76 ASSERT(OSThread::Current() == this);
77 ASSERT(name_ == NULL); 77 ASSERT(name_ == NULL);
78 name_ = name; 78 ASSERT(name != NULL);
79 name_ = strdup(name);
79 } 80 }
80 81
81 Mutex* timeline_block_lock() const { 82 Mutex* timeline_block_lock() const {
82 return timeline_block_lock_; 83 return timeline_block_lock_;
83 } 84 }
84 85
85 // Only safe to access when holding |timeline_block_lock_|. 86 // Only safe to access when holding |timeline_block_lock_|.
86 TimelineEventBlock* timeline_block() const { 87 TimelineEventBlock* timeline_block() const {
87 return timeline_block_; 88 return timeline_block_;
88 } 89 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 static ThreadJoinId GetCurrentThreadJoinId(); 196 static ThreadJoinId GetCurrentThreadJoinId();
196 static OSThread* GetOSThreadFromThread(Thread* thread); 197 static OSThread* GetOSThreadFromThread(Thread* thread);
197 static void AddThreadToList(OSThread* thread); 198 static void AddThreadToList(OSThread* thread);
198 static void RemoveThreadFromList(OSThread* thread); 199 static void RemoveThreadFromList(OSThread* thread);
199 200
200 static ThreadLocalKey thread_key_; 201 static ThreadLocalKey thread_key_;
201 202
202 const ThreadId id_; 203 const ThreadId id_;
203 const ThreadId join_id_; 204 const ThreadId join_id_;
204 const ThreadId trace_id_; // Used to interface with tracing tools. 205 const ThreadId trace_id_; // Used to interface with tracing tools.
205 const char* name_; // A name for this thread. 206 char* name_; // A name for this thread.
206 207
207 Mutex* timeline_block_lock_; 208 Mutex* timeline_block_lock_;
208 TimelineEventBlock* timeline_block_; 209 TimelineEventBlock* timeline_block_;
209 210
210 // All |Thread|s are registered in the thread list. 211 // All |Thread|s are registered in the thread list.
211 OSThread* thread_list_next_; 212 OSThread* thread_list_next_;
212 213
213 uintptr_t thread_interrupt_disabled_; 214 uintptr_t thread_interrupt_disabled_;
214 Log* log_; 215 Log* log_;
215 uword stack_base_; 216 uword stack_base_;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 #endif // defined(DEBUG) 314 #endif // defined(DEBUG)
314 315
315 DISALLOW_COPY_AND_ASSIGN(Monitor); 316 DISALLOW_COPY_AND_ASSIGN(Monitor);
316 }; 317 };
317 318
318 319
319 } // namespace dart 320 } // namespace dart
320 321
321 322
322 #endif // VM_OS_THREAD_H_ 323 #endif // VM_OS_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/os_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698