mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-03 17:45:12 +08:00
Add hybrid class to hold native delta client
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
This commit is contained in:
committed by
Facebook Github Bot
parent
4d931d529e
commit
82b8a9221a
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user