Files
react-native/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp
T
Paige Sun a7c026e667 Remove unused Fabric image instrumentation
Summary:
Remove the older implementation of image instrumentation in Fabric by removing, RCTImageInstrumentationProxy, ImageInstrumentation from ImageRequest, and trackURLImageContentDidSetForRequest from RCTImageLoaderWithAttributionProtocol.

Changelog: [RN][Fabric][Image] Remove unused Fabric image instrumentation

Reviewed By: fkgozali

Differential Revision: D23990606

fbshipit-source-id: 004d04025d031af11377a73e5bfb64b1e0449962
2020-09-29 14:19:09 -07:00

58 lines
1.4 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ImageRequest.h"
namespace facebook {
namespace react {
ImageRequest::ImageRequest(
const ImageSource &imageSource,
std::shared_ptr<const ImageTelemetry> telemetry)
: imageSource_(imageSource), telemetry_(telemetry) {
coordinator_ = std::make_shared<ImageResponseObserverCoordinator>();
}
ImageRequest::ImageRequest(ImageRequest &&other) noexcept
: imageSource_(std::move(other.imageSource_)),
telemetry_(std::move(other.telemetry_)),
coordinator_(std::move(other.coordinator_)) {
other.moved_ = true;
other.coordinator_ = nullptr;
other.cancelRequest_ = nullptr;
other.telemetry_ = nullptr;
}
ImageRequest::~ImageRequest() {
if (cancelRequest_) {
cancelRequest_();
}
}
void ImageRequest::setCancelationFunction(
std::function<void(void)> cancelationFunction) {
cancelRequest_ = cancelationFunction;
}
const std::shared_ptr<const ImageTelemetry> &ImageRequest::getSharedTelemetry()
const {
return telemetry_;
}
const ImageResponseObserverCoordinator &ImageRequest::getObserverCoordinator()
const {
return *coordinator_;
}
const std::shared_ptr<const ImageResponseObserverCoordinator>
&ImageRequest::getSharedObserverCoordinator() const {
return coordinator_;
}
} // namespace react
} // namespace facebook