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

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

Issue 1436153002: Apply clang-format with Chromium-style without column limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 | « 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 24 matching lines...) Expand all
35 #include "wtf/Functional.h" 35 #include "wtf/Functional.h"
36 #include "wtf/Threading.h" 36 #include "wtf/Threading.h"
37 #include "wtf/text/AtomicString.h" 37 #include "wtf/text/AtomicString.h"
38 #include "wtf/text/StringStatics.h" 38 #include "wtf/text/StringStatics.h"
39 39
40 namespace WTF { 40 namespace WTF {
41 41
42 static ThreadIdentifier mainThreadIdentifier; 42 static ThreadIdentifier mainThreadIdentifier;
43 static void (*callOnMainThreadFunction)(MainThreadFunction, void*); 43 static void (*callOnMainThreadFunction)(MainThreadFunction, void*);
44 44
45 void initializeMainThread(void (*function)(MainThreadFunction, void*)) 45 void initializeMainThread(void (*function)(MainThreadFunction, void*)) {
46 { 46 static bool initializedMainThread;
47 static bool initializedMainThread; 47 if (initializedMainThread)
48 if (initializedMainThread) 48 return;
49 return; 49 initializedMainThread = true;
50 initializedMainThread = true; 50 callOnMainThreadFunction = function;
51 callOnMainThreadFunction = function;
52 51
53 mainThreadIdentifier = currentThread(); 52 mainThreadIdentifier = currentThread();
54 53
55 AtomicString::init(); 54 AtomicString::init();
56 StringStatics::init(); 55 StringStatics::init();
57 } 56 }
58 57
59 namespace internal { 58 namespace internal {
60 59
61 void callOnMainThread(MainThreadFunction* function, void* context) 60 void callOnMainThread(MainThreadFunction* function, void* context) {
62 { 61 (*callOnMainThreadFunction)(function, context);
63 (*callOnMainThreadFunction)(function, context);
64 } 62 }
65 63
66 } // namespace internal 64 } // namespace internal
67 65
68 bool isMainThread() 66 bool isMainThread() {
69 { 67 return currentThread() == mainThreadIdentifier;
70 return currentThread() == mainThreadIdentifier;
71 } 68 }
72 69
73 } // namespace WTF 70 } // 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