Don't use the Bridge from CatalystInstance.

Summary: getBridge() is annotated VisibleForTesting, but still used
in DevSupportManager.  Instead, add the necessary methods to the
CatalystInstance interface.
public

Reviewed By: astreet

Differential Revision: D2651265

fb-gh-sync-id: 395893a961c32843871de4451eeccb33135b7ede
This commit is contained in:
Marc Horowitz 2015-11-20 12:16:39 -08:00 коммит произвёл facebook-github-bot-6
Родитель 5b6b5a64d1
Коммит c8f3b43984
2 изменённых файлов: 24 добавлений и 5 удалений

Просмотреть файл

@ -306,6 +306,27 @@ public class CatalystInstance {
mBridgeIdleListeners.remove(listener);
}
public boolean supportsProfiling() {
if (mBridge == null) {
return false;
}
return mBridge.supportsProfiling();
}
public void startProfiler(String title) {
if (mBridge == null) {
return;
}
mBridge.startProfiler(title);
}
public void stopProfiler(String title, String filename) {
if (mBridge == null) {
return;
}
mBridge.stopProfiler(title, filename);
}
private String buildModulesConfigJSONProperty(
NativeModuleRegistry nativeModuleRegistry,
JavaScriptModulesConfig jsModulesConfig) {

Просмотреть файл

@ -285,8 +285,7 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
if (mCurrentContext != null &&
mCurrentContext.getCatalystInstance() != null &&
!mCurrentContext.getCatalystInstance().isDestroyed() &&
mCurrentContext.getCatalystInstance().getBridge() != null &&
mCurrentContext.getCatalystInstance().getBridge().supportsProfiling()) {
mCurrentContext.getCatalystInstance().supportsProfiling()) {
options.put(
mApplicationContext.getString(
mIsCurrentlyProfiling ? R.string.catalyst_stop_profile :
@ -302,7 +301,6 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
mProfileIndex++;
Debug.stopMethodTracing();
mCurrentContext.getCatalystInstance()
.getBridge()
.stopProfiler("profile", profileName);
Toast.makeText(
mCurrentContext,
@ -310,7 +308,7 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
Toast.LENGTH_LONG).show();
} else {
mIsCurrentlyProfiling = true;
mCurrentContext.getCatalystInstance().getBridge().startProfiler("profile");
mCurrentContext.getCatalystInstance().startProfiler("profile");
Debug.startMethodTracingSampling(
profileName,
JAVA_SAMPLING_PROFILE_MEMORY_BYTES,
@ -476,7 +474,7 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
"/profile_" + mProfileIndex + ".json");
mProfileIndex++;
Debug.stopMethodTracing();
mCurrentContext.getCatalystInstance().getBridge().stopProfiler("profile", profileName);
mCurrentContext.getCatalystInstance().stopProfiler("profile", profileName);
}
mCurrentContext = reactContext;