MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / loadAsyncUnsafe

Method loadAsyncUnsafe

Source/Basic/Content.cpp:1164–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162}
1163
1164void Content::loadAsyncUnsafe(String filename, const std::function<void(uint8_t*, int64_t)>& callback) {
1165 std::string fileStr = filename.toString();
1166 _thread->run(
1167 [fileStr, this]() {
1168 int64_t size = 0;
1169 uint8_t* buffer = this->loadUnsafe(fileStr, size);
1170 return Values::alloc(buffer, size);
1171 },
1172 [callback](Own<Values> result) {
1173 uint8_t* buffer;
1174 int64_t size;
1175 result->get(buffer, size);
1176 callback(buffer, size);
1177 });
1178}
1179
1180void Content::loadAsync(String filename, const std::function<void(String)>& callback) {
1181 Content::loadAsyncUnsafe(filename, [callback](uint8_t* buffer, int64_t size) {

Callers 5

loadAsyncMethod · 0.80
loadAyncMethod · 0.80
loadAsyncMethod · 0.80
loadAsyncMethod · 0.80
playStreamMethod · 0.80

Calls 5

loadUnsafeMethod · 0.95
toStringMethod · 0.65
runMethod · 0.65
getMethod · 0.65
allocFunction · 0.50

Tested by

no test coverage detected