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

Side by Side Diff: src/core/SkMessageBus.h

Issue 1214603003: Revert of Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 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 | « src/core/SkImageFilter.cpp ('k') | src/core/SkPaint.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMessageBus_DEFINED 8 #ifndef SkMessageBus_DEFINED
9 #define SkMessageBus_DEFINED 9 #define SkMessageBus_DEFINED
10 10
11 #include "SkLazyPtr.h" 11 #include "SkLazyPtr.h"
12 #include "SkMutex.h"
13 #include "SkTArray.h" 12 #include "SkTArray.h"
14 #include "SkTDArray.h" 13 #include "SkTDArray.h"
14 #include "SkThread.h"
15 #include "SkTypes.h" 15 #include "SkTypes.h"
16 16
17 template <typename Message> 17 template <typename Message>
18 class SkMessageBus : SkNoncopyable { 18 class SkMessageBus : SkNoncopyable {
19 public: 19 public:
20 // Post a message to be received by all Inboxes for this Message type. Thre adsafe. 20 // Post a message to be received by all Inboxes for this Message type. Thre adsafe.
21 static void Post(const Message& m); 21 static void Post(const Message& m);
22 22
23 class Inbox { 23 class Inbox {
24 public: 24 public:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 template <typename Message> 102 template <typename Message>
103 /*static*/ void SkMessageBus<Message>::Post(const Message& m) { 103 /*static*/ void SkMessageBus<Message>::Post(const Message& m) {
104 SkMessageBus<Message>* bus = SkMessageBus<Message>::Get(); 104 SkMessageBus<Message>* bus = SkMessageBus<Message>::Get();
105 SkAutoMutexAcquire lock(bus->fInboxesMutex); 105 SkAutoMutexAcquire lock(bus->fInboxesMutex);
106 for (int i = 0; i < bus->fInboxes.count(); i++) { 106 for (int i = 0; i < bus->fInboxes.count(); i++) {
107 bus->fInboxes[i]->receive(m); 107 bus->fInboxes[i]->receive(m);
108 } 108 }
109 } 109 }
110 110
111 #endif // SkMessageBus_DEFINED 111 #endif // SkMessageBus_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698