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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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 | « src/core/SkMatrix.cpp ('k') | src/core/SkMultiPictureDraw.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
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 template<typename Message> 80 template<typename Message>
81 void SkMessageBus<Message>::Inbox::receive(const Message& m) { 81 void SkMessageBus<Message>::Inbox::receive(const Message& m) {
82 SkAutoMutexAcquire lock(fMessagesMutex); 82 SkAutoMutexAcquire lock(fMessagesMutex);
83 fMessages.push(m); 83 fMessages.push(m);
84 } 84 }
85 85
86 template<typename Message> 86 template<typename Message>
87 void SkMessageBus<Message>::Inbox::poll(SkTDArray<Message>* messages) { 87 void SkMessageBus<Message>::Inbox::poll(SkTDArray<Message>* messages) {
88 SkASSERT(NULL != messages); 88 SkASSERT(messages);
89 messages->reset(); 89 messages->reset();
90 SkAutoMutexAcquire lock(fMessagesMutex); 90 SkAutoMutexAcquire lock(fMessagesMutex);
91 messages->swap(fMessages); 91 messages->swap(fMessages);
92 } 92 }
93 93
94 // ----------------------- Implementation of SkMessageBus -------------------- --- 94 // ----------------------- Implementation of SkMessageBus -------------------- ---
95 95
96 template <typename Message> 96 template <typename Message>
97 SkMessageBus<Message>::SkMessageBus() {} 97 SkMessageBus<Message>::SkMessageBus() {}
98 98
99 template <typename Message> 99 template <typename Message>
100 /*static*/ SkMessageBus<Message>* SkMessageBus<Message>::New() { 100 /*static*/ SkMessageBus<Message>* SkMessageBus<Message>::New() {
101 return SkNEW(SkMessageBus<Message>); 101 return SkNEW(SkMessageBus<Message>);
102 } 102 }
103 103
104 template <typename Message> 104 template <typename Message>
105 /*static*/ void SkMessageBus<Message>::Post(const Message& m) { 105 /*static*/ void SkMessageBus<Message>::Post(const Message& m) {
106 SkMessageBus<Message>* bus = SkMessageBus<Message>::Get(); 106 SkMessageBus<Message>* bus = SkMessageBus<Message>::Get();
107 SkAutoMutexAcquire lock(bus->fInboxesMutex); 107 SkAutoMutexAcquire lock(bus->fInboxesMutex);
108 for (int i = 0; i < bus->fInboxes.count(); i++) { 108 for (int i = 0; i < bus->fInboxes.count(); i++) {
109 bus->fInboxes[i]->receive(m); 109 bus->fInboxes[i]->receive(m);
110 } 110 }
111 } 111 }
112 112
113 #endif // SkMessageBus_DEFINED 113 #endif // SkMessageBus_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkMatrix.cpp ('k') | src/core/SkMultiPictureDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698