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

Side by Side Diff: sky/engine/wtf/MainThread.cpp

Issue 691493004: Remove callOnMainThread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « sky/engine/wtf/MainThread.h ('k') | sky/engine/wtf/testing/RunAllTests.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) 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "wtf/MainThread.h" 32 #include "wtf/MainThread.h"
33 33
34 #include "wtf/Assertions.h" 34 #include "wtf/Assertions.h"
35 #include "wtf/Threading.h" 35 #include "wtf/Threading.h"
36 #include "wtf/text/AtomicString.h" 36 #include "wtf/text/AtomicString.h"
37 37
38 namespace WTF { 38 namespace WTF {
39 39
40 static ThreadIdentifier mainThreadIdentifier; 40 static ThreadIdentifier mainThreadIdentifier;
41 static void (*callOnMainThreadFunction)(MainThreadFunction, void*);
42 41
43 void initializeMainThread(void (*function)(MainThreadFunction, void*)) 42 void initializeMainThread()
44 { 43 {
45 static bool initializedMainThread; 44 static bool initializedMainThread;
46 if (initializedMainThread) 45 if (initializedMainThread)
47 return; 46 return;
48 initializedMainThread = true; 47 initializedMainThread = true;
49 callOnMainThreadFunction = function;
50 48
51 mainThreadIdentifier = currentThread(); 49 mainThreadIdentifier = currentThread();
52
53 AtomicString::init(); 50 AtomicString::init();
54 } 51 }
55 52
56 void callOnMainThread(MainThreadFunction* function, void* context)
57 {
58 (*callOnMainThreadFunction)(function, context);
59 }
60
61 bool isMainThread() 53 bool isMainThread()
62 { 54 {
63 return currentThread() == mainThreadIdentifier; 55 return currentThread() == mainThreadIdentifier;
64 } 56 }
65 57
66 } // namespace WTF 58 } // namespace WTF
67 59
OLDNEW
« no previous file with comments | « sky/engine/wtf/MainThread.h ('k') | sky/engine/wtf/testing/RunAllTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698