From da284f6e36fbde98790bd77fe1262f72eaec46a2 Mon Sep 17 00:00:00 2001 From: Amir Rosenfeld Date: Wed, 23 Sep 2015 10:28:10 -0700 Subject: [PATCH] stub Java QPL for OSS Reviewed By: @mkonicek Differential Revision: D2470258 --- .../quicklog/QuickPerformanceLogger.java | 93 +++++++++++++++++++ .../QuickPerformanceLoggerProvider.java | 24 +++++ .../quicklog/identifiers/ActionId.java | 51 ++++++++++ .../identifiers/ReactNativeBridge.java | 21 +++++ 4 files changed, 189 insertions(+) create mode 100644 ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLogger.java create mode 100644 ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLoggerProvider.java create mode 100644 ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ActionId.java create mode 100644 ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ReactNativeBridge.java diff --git a/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLogger.java b/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLogger.java new file mode 100644 index 000000000..9e3e0e32e --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLogger.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.quicklog; + +/** + * Stub implementation of QPL + */ +public class QuickPerformanceLogger { + + public void markerStart( + int markerId) { + } + + public void markerStart( + int markerId, + int instnaceKey) { + } + + public void markerStart( + int markerId, + int instnaceKey, + long timestamp) { + } + + public void markerEnd( + int markerId, + short actionId) { + } + + public void markerEnd( + int markerId, + int instanceKey, + short actionId) { + } + + public void markerEnd( + int markerId, + int instanceKey, + short actionId, + long timestamp) { + } + + public void markerNote( + int markerId, + short actionId) { + } + + public void markerNote( + int markerId, + int instanceKey, + short actionId) { + } + + public void markerNote( + int markerId, + int instanceKey, + short actionId, + long timestamp) { + } + + public void markerCancel( + int markerId) { + } + + public void markerCancel( + int markerId, + int instanceKey) { + } + + public void markerTag( + int markerId, + String tag) { + } + + public void markerTag( + int markerId, + int instanceKey, + String tag) { + } + + public long currentMonotonicTimestamp() { + return 0L; + } + +} + diff --git a/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLoggerProvider.java b/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLoggerProvider.java new file mode 100644 index 000000000..903175bcf --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/quicklog/QuickPerformanceLoggerProvider.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.quicklog; + +/** + * Provides stub implementation of QPL + */ +public class QuickPerformanceLoggerProvider { + + private static final QuickPerformanceLogger sQuickPerformanceLogger = + new QuickPerformanceLogger(); + + public static QuickPerformanceLogger getQPLInstance() { + return sQuickPerformanceLogger; + } +} + diff --git a/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ActionId.java b/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ActionId.java new file mode 100644 index 000000000..1a55fdb48 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ActionId.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2015-present; Facebook; Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.quicklog.identifiers; + +/** + * Stub implementation of Action Identifiers. + * Use your own implementation with you own implementation of QuickPerformanceLogger + */ +public class ActionId { + + /** Don't use this action identifier */ + public static short UNDEFINED = 0; + + /** This starts all markers */ + public static short START = 0; + + /** Successful termination of the marker */ + public static short SUCCESS = 0; + + /** Termination of marker due to some failure */ + public static short FAIL = 0; + + /** Termination of marker due to a cancellation */ + public static short CANCEL = 0; + + /** Some (general) drawing action has completed */ + public static short DRAW_COMPLETE = 0; + + /** General pause poshort */ + public static short PAUSE = 0; + + /** General resume poshort */ + public static short RESUME = 0; + + /** Insertion into a queue */ + public static short QUEUED = 0; + + /** Some error occurred */ + public static short ERROR = 0; + + /** Denoting a finally situation */ + public static short FINALLY = 0; +} + diff --git a/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ReactNativeBridge.java b/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ReactNativeBridge.java new file mode 100644 index 000000000..bd1b5b3d5 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/quicklog/identifiers/ReactNativeBridge.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.quicklog.identifiers; + +/** + * Stub definition of identifier needed in react native open source code. + * Use your own identifiers with your own QuickPerformanceLogger implementation + */ +public class ReactNativeBridge { + + public static final int CALL_JAVA_MODULE_METHOD = 0; + +} +