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

Side by Side Diff: third_party/WebKit/Source/wtf/ThreadingPthreads.cpp

Issue 2345543002: debugging for crbug.com/646539
Patch Set: 3 TUs, 2 .h Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/wtf/WTF.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #if OS(LINUX) 52 #if OS(LINUX)
53 #include <sys/syscall.h> 53 #include <sys/syscall.h>
54 #endif 54 #endif
55 55
56 #if OS(LINUX) || OS(ANDROID) 56 #if OS(LINUX) || OS(ANDROID)
57 #include <unistd.h> 57 #include <unistd.h>
58 #endif 58 #endif
59 59
60 namespace WTF { 60 namespace WTF {
61 61
62 static Mutex* atomicallyInitializedStaticMutex;
63
64 void initializeThreading() 62 void initializeThreading()
65 { 63 {
66 // This should only be called once. 64 //wtfThreadData();
67 ASSERT(!atomicallyInitializedStaticMutex);
68
69 // StringImpl::empty() does not construct its static string in a threadsafe fashion,
70 // so ensure it has been initialized from here.
71 StringImpl::empty();
72 StringImpl::empty16Bit();
73 atomicallyInitializedStaticMutex = new Mutex;
74 wtfThreadData();
75 initializeDates();
76 // Force initialization of static DoubleToStringConverter converter variable
77 // inside EcmaScriptConverter function while we are in single thread mode.
78 double_conversion::DoubleToStringConverter::EcmaScriptConverter();
79 } 65 }
80 66
81 void lockAtomicallyInitializedStaticMutex() 67 void lockAtomicallyInitializedStaticMutex()
82 { 68 {
83 ASSERT(atomicallyInitializedStaticMutex);
84 atomicallyInitializedStaticMutex->lock();
85 } 69 }
86 70
87 void unlockAtomicallyInitializedStaticMutex() 71 void unlockAtomicallyInitializedStaticMutex()
88 { 72 {
89 atomicallyInitializedStaticMutex->unlock();
90 } 73 }
91 74
92 ThreadIdentifier currentThread() 75 ThreadIdentifier currentThread()
93 { 76 {
94 #if OS(MACOSX) 77 #if OS(MACOSX)
95 return pthread_mach_thread_np(pthread_self()); 78 return pthread_mach_thread_np(pthread_self());
96 #elif OS(LINUX) 79 #elif OS(LINUX)
97 return syscall(__NR_gettid); 80 return syscall(__NR_gettid);
98 #elif OS(ANDROID) 81 #elif OS(ANDROID)
99 return gettid(); 82 return gettid();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 237
255 void willCreateThread() 238 void willCreateThread()
256 { 239 {
257 s_threadCreated = true; 240 s_threadCreated = true;
258 } 241 }
259 #endif 242 #endif
260 243
261 } // namespace WTF 244 } // namespace WTF
262 245
263 #endif // OS(POSIX) 246 #endif // OS(POSIX)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/wtf/WTF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698