mirror of
https://github.com/react/react-native.git
synced 2026-10-30 02:23:12 +08:00
Summary: Adds hybrid JNI wrapper class that can hold a native delta client. This class allows Java code in the `devsupport` package to hold onto a native delta client across reloads. It also takes care of passing `okhttp` response objects to native code, where we build a `std::string` to hold JSON messages coming from Metro, and parse them with `folly::parseJson`. In a follow-up, we will switch to a streaming-friendly binary format that will make allocating memory for the whole message unnecessary. Reviewed By: fromcelticpark Differential Revision: D7845138 fbshipit-source-id: 7a29b30645331addf843097dd0d05c03b3143991
26 lines
604 B
Java
26 lines
604 B
Java
/**
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
package com.facebook.react.bridge;
|
|
|
|
import java.nio.channels.ReadableByteChannel;
|
|
|
|
import com.facebook.jni.HybridData;
|
|
|
|
public class NativeDeltaClient {
|
|
static {
|
|
ReactBridge.staticInit();
|
|
}
|
|
|
|
// C++ parts
|
|
private final HybridData mHybridData = initHybrid();
|
|
private native static HybridData initHybrid();
|
|
|
|
public native void reset();
|
|
public native void processDelta(ReadableByteChannel deltaMessage);
|
|
}
|