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

Side by Side Diff: base/threading/platform_thread_mac.mm

Issue 1845753006: Don't create redundant ThreadData for Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 #include <mach/mach_time.h> 9 #include <mach/mach_time.h>
10 #include <mach/thread_policy.h> 10 #include <mach/thread_policy.h>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 [NSThread detachNewThreadSelector:@selector(class) 42 [NSThread detachNewThreadSelector:@selector(class)
43 toTarget:[NSObject class] 43 toTarget:[NSObject class]
44 withObject:nil]; 44 withObject:nil];
45 multithreaded = YES; 45 multithreaded = YES;
46 46
47 DCHECK([NSThread isMultiThreaded]); 47 DCHECK([NSThread isMultiThreaded]);
48 } 48 }
49 } 49 }
50 50
51 // static 51 // static
52 void PlatformThread::SetName(const std::string& name) { 52 void PlatformThread::SetName(const std::string& name, bool is_worker_thread) {
53 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); 53 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
54 tracked_objects::ThreadData::InitializeThreadContext(name); 54 if (!is_worker_thread)
55 tracked_objects::ThreadData::InitializeThreadContext(name);
55 56
56 // Mac OS X does not expose the length limit of the name, so 57 // Mac OS X does not expose the length limit of the name, so
57 // hardcode it. 58 // hardcode it.
58 const int kMaxNameLength = 63; 59 const int kMaxNameLength = 63;
59 std::string shortened_name = name.substr(0, kMaxNameLength); 60 std::string shortened_name = name.substr(0, kMaxNameLength);
60 // pthread_setname() fails (harmlessly) in the sandbox, ignore when it does. 61 // pthread_setname() fails (harmlessly) in the sandbox, ignore when it does.
61 // See http://crbug.com/47058 62 // See http://crbug.com/47058
62 pthread_setname_np(shortened_name.c_str()); 63 pthread_setname_np(shortened_name.c_str());
63 } 64 }
64 65
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 static_cast<size_t>(stack_rlimit.rlim_cur)); 239 static_cast<size_t>(stack_rlimit.rlim_cur));
239 } 240 }
240 return default_stack_size; 241 return default_stack_size;
241 #endif 242 #endif
242 } 243 }
243 244
244 void TerminateOnThread() { 245 void TerminateOnThread() {
245 } 246 }
246 247
247 } // namespace base 248 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698