Files
swift-mirror/tools/SourceKit/lib/Core/NotificationCenter.cpp
Argyrios Kyrtzidis 8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00

23 lines
574 B
C++

#include "SourceKit/Core/NotificationCenter.h"
#include "SourceKit/Support/Concurrency.h"
using namespace SourceKit;
void NotificationCenter::addDocumentUpdateNotificationReceiver(
DocumentUpdateNotificationReceiver Receiver) {
WorkQueue::dispatchOnMain([this, Receiver]{
DocUpdReceivers.push_back(Receiver);
});
}
void NotificationCenter::postDocumentUpdateNotification(
StringRef DocumentName) const {
std::string DocName = DocumentName;
WorkQueue::dispatchOnMain([this, DocName]{
for (auto &Fn : DocUpdReceivers)
Fn(DocName);
});
}