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

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

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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/wtf/MainThread.h ('k') | third_party/WebKit/Source/wtf/MathExtras.h » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 23 matching lines...) Expand all
34 #include "wtf/Functional.h" 34 #include "wtf/Functional.h"
35 #include "wtf/Threading.h" 35 #include "wtf/Threading.h"
36 #include "wtf/text/AtomicString.h" 36 #include "wtf/text/AtomicString.h"
37 #include "wtf/text/StringStatics.h" 37 #include "wtf/text/StringStatics.h"
38 38
39 namespace WTF { 39 namespace WTF {
40 40
41 static ThreadIdentifier mainThreadIdentifier; 41 static ThreadIdentifier mainThreadIdentifier;
42 static void (*callOnMainThreadFunction)(MainThreadFunction, void*); 42 static void (*callOnMainThreadFunction)(MainThreadFunction, void*);
43 43
44 void initializeMainThread(void (*function)(MainThreadFunction, void*)) 44 void initializeMainThread(void (*function)(MainThreadFunction, void*)) {
45 { 45 static bool initializedMainThread;
46 static bool initializedMainThread; 46 if (initializedMainThread)
47 if (initializedMainThread) 47 return;
48 return; 48 initializedMainThread = true;
49 initializedMainThread = true; 49 callOnMainThreadFunction = function;
50 callOnMainThreadFunction = function;
51 50
52 mainThreadIdentifier = currentThread(); 51 mainThreadIdentifier = currentThread();
53 52
54 AtomicString::init(); 53 AtomicString::init();
55 StringStatics::init(); 54 StringStatics::init();
56 } 55 }
57 56
58 namespace internal { 57 namespace internal {
59 58
60 void callOnMainThread(MainThreadFunction* function, void* context) 59 void callOnMainThread(MainThreadFunction* function, void* context) {
61 { 60 (*callOnMainThreadFunction)(function, context);
62 (*callOnMainThreadFunction)(function, context);
63 } 61 }
64 62
65 } // namespace internal 63 } // namespace internal
66 64
67 bool isMainThread() 65 bool isMainThread() {
68 { 66 return currentThread() == mainThreadIdentifier;
69 return currentThread() == mainThreadIdentifier;
70 } 67 }
71 68
72 } // namespace WTF 69 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/MainThread.h ('k') | third_party/WebKit/Source/wtf/MathExtras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698