225 {
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242 auto raw_descriptor = descriptor_ref_ptr.get();
243 raw_descriptor->AddRef();
244
247
248
254 flow = std::move(flow)]() mutable {
255
256
258 flow.End();
260 raw_descriptor->Release();
261 }));
262 };
263
264 if (!raw_descriptor->data() || raw_descriptor->data()->size() == 0) {
265 result({}, std::move(flow));
266 return;
267 }
268
274 target_width = target_width,
275 target_height = target_height,
276 flow = std::move(flow)
277 ]() mutable {
278
279
280
281 auto decompressed = raw_descriptor->is_compressed()
282 ? ImageFromCompressedData(raw_descriptor,
283 target_width,
284 target_height,
285 flow)
286 : ImageFromDecompressedData(raw_descriptor,
287 target_width,
288 target_height,
289 flow);
290
291 if (!decompressed) {
292 FML_DLOG(ERROR) << "Could not decompress image.";
293 result({}, std::move(flow));
294 return;
295 }
296
297
298
299
301 flow =
302 std::move(flow)]() mutable {
303 if (!io_manager) {
304 FML_DLOG(ERROR) << "Could not acquire IO manager.";
305 result({}, std::move(flow));
306 return;
307 }
308
309
310
311
312 if (!io_manager->GetResourceContext()) {
313 result({std::move(decompressed), io_manager->GetSkiaUnrefQueue()},
314 std::move(flow));
315 return;
316 }
317
318 auto uploaded =
320
321 if (!uploaded.skia_object()) {
323 result({}, std::move(flow));
324 return;
325 }
326
327
328 result(std::move(uploaded), std::move(flow));
329 }));
330 }));
331}
static sk_sp< DlImageGPU > Make(SkiaGPUObject< SkImage > image)
std::shared_ptr< fml::ConcurrentTaskRunner > concurrent_task_runner_
fml::WeakPtr< IOManager > io_manager_
fml::RefPtr< fml::TaskRunner > GetUITaskRunner() const
fml::RefPtr< fml::TaskRunner > GetIOTaskRunner() const
virtual bool RunsTasksOnCurrentThread()
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_DLOG(severity)
#define FML_DCHECK(condition)
sk_sp< const SkImage > image
static SkiaGPUObject< SkImage > UploadRasterImage(sk_sp< SkImage > image, const fml::WeakPtr< IOManager > &io_manager, const fml::tracing::TraceFlow &flow)
internal::CopyableLambda< T > MakeCopyable(T lambda)
#define TRACE_EVENT0(category_group, name)