Skip to content

Commit

Permalink
fbandroid/libraries/fresco/tools/flipper-fresco-plugin/src/main/java/…
Browse files Browse the repository at this point in the history
…com/facebook/flipper/plugins/fresco/objecthelper/FlipperObjectHelper.java

Reviewed By: jocelynluizzi13

Differential Revision: D64682099

fbshipit-source-id: 5b388b88c9b89b887f79363f3889e719ead5542f
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Oct 23, 2024
1 parent 015088c commit 2ccbdb7
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
import com.facebook.imagepipeline.image.ImageInfo;
import com.facebook.imagepipeline.image.QualityInfo;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.infer.annotation.Nullsafe;
import java.util.Map;
import javax.annotation.Nullable;

/** Serialization helper to create {@link FlipperObject}s. */
@Nullsafe(Nullsafe.Mode.LOCAL)
public abstract class FlipperObjectHelper {

public FlipperObject keyValuePair(String key, @Nullable String value) {
// NULLSAFE_FIXME[Parameter Not Nullable]
return new FlipperObject.Builder().put(key, value).build();
}

Expand Down Expand Up @@ -141,21 +144,23 @@ public FlipperObject toFlipperObject(@Nullable ImagePerfData imagePerfData) {
return null;
}
FlipperObject.Builder objectJson = new FlipperObject.Builder();
// NULLSAFE_FIXME[Parameter Not Nullable]
objectJson.put("requestId", imagePerfData.getRequestId());
objectJson.put("controllerSubmitTimeMs", imagePerfData.getControllerSubmitTimeMs());
objectJson.put("controllerFinalTimeMs", imagePerfData.getControllerFinalImageSetTimeMs());
objectJson.put("imageRequestStartTimeMs", imagePerfData.getImageRequestStartTimeMs());
objectJson.put("imageRequestEndTimeMs", imagePerfData.getImageRequestEndTimeMs());
objectJson.put("imageOrigin", "UNKNOWN");
objectJson.put("isPrefetch", imagePerfData.isPrefetch());
// NULLSAFE_FIXME[Parameter Not Nullable]
objectJson.put("callerContext", imagePerfData.getCallerContext());
objectJson.put("imageRequest", toFlipperObject((ImageRequest) imagePerfData.getImageRequest()));
objectJson.put("imageInfo", toFlipperObject((ImageInfo) imagePerfData.getImageInfo()));
return objectJson.build();
}

@Nullable
public FlipperObject toFlipperObject(ImageInfo imageInfo) {
public FlipperObject toFlipperObject(@Nullable ImageInfo imageInfo) {
if (imageInfo == null) {
return null;
}
Expand All @@ -167,7 +172,7 @@ public FlipperObject toFlipperObject(ImageInfo imageInfo) {
}

@Nullable
public FlipperObject toFlipperObject(QualityInfo qualityInfo) {
public FlipperObject toFlipperObject(@Nullable QualityInfo qualityInfo) {
if (qualityInfo == null) {
return null;
}
Expand Down Expand Up @@ -196,6 +201,7 @@ public FlipperObject.Builder addImageRequestProperties(
.put("postprocessor", String.valueOf(request.getPostprocessor()))
.put("requestListener", String.valueOf(request.getRequestListener()))
.put("imageDecodeOptions", toFlipperObject(request.getImageDecodeOptions()))
// NULLSAFE_FIXME[Parameter Not Nullable]
.put("bytesRange", request.getBytesRange())
.put("resizeOptions", toFlipperObject(request.getResizeOptions()))
.put("rotationOptions", toFlipperObject(request.getRotationOptions()));
Expand Down

0 comments on commit 2ccbdb7

Please sign in to comment.