Java Code Examples for com.facebook.common.logging.FLog#d()
The following examples show how to use
com.facebook.common.logging.FLog#d() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiskStorageCache.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
@Override public BinaryResource insert(CacheKey key, WriterCallback callback) throws IOException { // Write to a temp file, then move it into place. This allows more parallelism // when writing files. mCacheEventListener.onWriteAttempt(); final String resourceId = getResourceId(key); try { // getting the file is synchronized BinaryResource temporary = createTemporaryResource(resourceId, key); try { mStorageSupplier.get().updateResource(resourceId, temporary, callback, key); // Committing the file is synchronized return commitResource(resourceId, key, temporary); } finally { deleteTemporaryResource(temporary); } } catch (IOException ioe) { mCacheEventListener.onWriteException(); FLog.d(TAG, "Failed inserting a file into the cache", ioe); throw ioe; } }
Example 2
Source File: ObjectPool.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
/** * Checks whether the compaction policies set for this pool have been satisfied */ public synchronized void checkUsage() { final long now = mClock.now(); // this check prevents compaction from occurring by setting the last timestamp // to right now when the size is less than 2x the increment size (default // ObjectPoolBuilder.DEFAULT_INCREMENT_SIZE). if (mSize < 2*mIncrementSize) { mLastLowSupplyTimeMs = now; } if (now - mLastLowSupplyTimeMs > mCompactionDelayMs) { FLog.d(TAG, "ObjectPool.checkUsage is compacting the pool."); compactUsage(); } }
Example 3
Source File: FabricReconciler.java From react-native-GPay with MIT License | 6 votes |
private void enqueueUpdateProperties(ReactShadowNode newNode, ReactShadowNode prevNode) { int reactTag = newNode.getReactTag(); if (DEBUG) { FLog.d( TAG, "manageChildren.enqueueUpdateProperties " + "\n\ttag: " + reactTag + "\n\tviewClass: " + newNode.getViewClass() + "\n\tinstanceHandle: " + newNode.getInstanceHandle() + "\n\tnewProps: " + newNode.getNewProps()); } if (prevNode != null) { newNode.updateScreenLayout(prevNode); } if (newNode.getNewProps() != null) { uiViewOperationQueue.enqueueUpdateProperties( reactTag, newNode.getViewClass(), newNode.getNewProps()); } uiViewOperationQueue.enqueueUpdateInstanceHandle( reactTag, newNode.getInstanceHandle()); }
Example 4
Source File: FabricUIManager.java From react-native-GPay with MIT License | 6 votes |
/** * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned * ReactShadowNode will contain a copy of all the internal data of the original node, * including its children set (note that the children nodes will not be cloned). */ @Nullable @DoNotStrip public ReactShadowNode cloneNode(ReactShadowNode node) { if (DEBUG) { FLog.d(TAG, "cloneNode \n\tnode: " + node); } SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.cloneNode") .flush(); try { ReactShadowNode clone = node.mutableCopy(node.getInstanceHandle()); assertReactShadowNodeCopy(node, clone); return clone; } catch (Throwable t) { handleException(node, t); return null; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 5
Source File: FabricUIManager.java From react-native-GPay with MIT License | 6 votes |
/** * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned * ReactShadowNode will contain a copy of all the internal data of the original node, but its * props will be overridden with the {@link ReadableMap} received by parameter. */ @Nullable @DoNotStrip public ReactShadowNode cloneNodeWithNewProps( ReactShadowNode node, @Nullable ReadableNativeMap newProps) { if (DEBUG) { FLog.d(TAG, "cloneNodeWithNewProps \n\tnode: " + node + "\n\tprops: " + newProps); } SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.cloneNodeWithNewProps") .flush(); try { ReactShadowNode clone = node.mutableCopyWithNewProps(node.getInstanceHandle(), newProps == null ? null : new ReactStylesDiffMap(newProps)); assertReactShadowNodeCopy(node, clone); return clone; } catch (Throwable t) { handleException(node, t); return null; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 6
Source File: FabricUIManager.java From react-native-GPay with MIT License | 6 votes |
/** * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned * ReactShadowNode will contain a copy of all the internal data of the original node, but its * props will be overridden with the {@link ReadableMap} received by parameter and its * children set will be empty. */ @Nullable @DoNotStrip public ReactShadowNode cloneNodeWithNewChildrenAndProps( ReactShadowNode node, ReadableNativeMap newProps) { if (DEBUG) { FLog.d(TAG, "cloneNodeWithNewChildrenAndProps \n\tnode: " + node + "\n\tnewProps: " + newProps); } SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.cloneNodeWithNewChildrenAndProps") .flush(); try { ReactShadowNode clone = node.mutableCopyWithNewChildrenAndProps(node.getInstanceHandle(), newProps == null ? null : new ReactStylesDiffMap(newProps)); assertReactShadowNodeCopy(node, clone); return clone; } catch (Throwable t) { handleException(node, t); return null; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 7
Source File: DebugBitmapAnimationFrameListener.java From fresco with MIT License | 5 votes |
@Override public void onFrameDrawn( BitmapAnimationBackend backend, int frameNumber, @BitmapAnimationBackend.FrameType int frameType) { increaseFrameTypeCount(frameType); FLog.d( TAG, "Frame: event=drawn, number=%d, type=%s, render_time=%d ms", frameNumber, getFrameTypeName(frameType), System.currentTimeMillis() - mLastFrameStart); logStatistics(); }
Example 8
Source File: MainReactPackageWithFrescoCache.java From react-native-image-filter-kit with MIT License | 5 votes |
private Supplier<MemoryCacheParams> createCacheParamsSupplier( final ReactApplicationContext context ) { ActivityManager manager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); final Supplier<MemoryCacheParams> cacheParamsSupplier = new DefaultBitmapMemoryCacheParamsSupplier(manager) { @Override public MemoryCacheParams get() { MemoryCacheParams params = super.get(); return new MemoryCacheParams( mMaxCacheSizeInBytes == null ? params.maxCacheSize : mMaxCacheSizeInBytes, mMaxCacheEntries == null ? params.maxCacheEntries : mMaxCacheEntries, params.maxEvictionQueueSize, params.maxEvictionQueueEntries, params.maxCacheEntrySize ); } }; String size = String.valueOf(cacheParamsSupplier.get().maxCacheSize / 1024 / 1024); String entries = String.valueOf(cacheParamsSupplier.get().maxCacheEntries); FLog.d( ReactConstants.TAG, "ImageFilterKit: Fresco cache size - " + entries + " entries, " + size + " MB overall" ); return cacheParamsSupplier; }
Example 9
Source File: ReactShadowNodeImpl.java From react-native-GPay with MIT License | 5 votes |
@Override public YogaNode cloneNode(YogaNode oldYogaNode, YogaNode parent, int childIndex) { SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricReconciler.YogaNodeCloneFunction") .flush(); try { ReactShadowNodeImpl parentReactShadowNode = (ReactShadowNodeImpl) parent.getData(); Assertions.assertNotNull(parentReactShadowNode); ReactShadowNodeImpl oldReactShadowNode = (ReactShadowNodeImpl) oldYogaNode.getData(); Assertions.assertNotNull(oldReactShadowNode); if (DEBUG) { FLog.d( TAG, "YogaNode started cloning: oldYogaNode: " + oldReactShadowNode + " - parent: " + parentReactShadowNode + " index: " + childIndex); } ReactShadowNodeImpl newNode = oldReactShadowNode.mutableCopy(oldReactShadowNode.getInstanceHandle()); parentReactShadowNode.replaceChild(newNode, childIndex); return newNode.mYogaNode; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 10
Source File: UIManagerModule.java From react-native-GPay with MIT License | 5 votes |
/** * Interface for fast tracking the initial adding of views. Children view tags are assumed to be * in order * * @param viewTag the view tag of the parent view * @param childrenTags An array of tags to add to the parent in order */ @ReactMethod public void setChildren( int viewTag, ReadableArray childrenTags) { if (DEBUG) { String message = "(UIManager.setChildren) tag: " + viewTag + ", children: " + childrenTags; FLog.d(ReactConstants.TAG, message); PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message); } mUIImplementation.setChildren(viewTag, childrenTags); }
Example 11
Source File: DebugBitmapAnimationFrameListener.java From fresco with MIT License | 5 votes |
@Override public void onFrameDropped(BitmapAnimationBackend backend, int frameNumber) { mDroppedFrameCount++; FLog.d( TAG, "Frame: event=dropped, number=%d, render_time=%d ms", frameNumber, System.currentTimeMillis() - mLastFrameStart); logStatistics(); }
Example 12
Source File: FabricUIManager.java From react-native-GPay with MIT License | 5 votes |
private ReactShadowNode calculateDiffingAndCreateNewRootNode( ReactShadowNode currentRootShadowNode, List<ReactShadowNode> newChildList) { SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.calculateDiffingAndCreateNewRootNode") .flush(); try { ReactShadowNode newRootShadowNode = currentRootShadowNode.mutableCopyWithNewChildren(currentRootShadowNode.getInstanceHandle()); for (ReactShadowNode child : newChildList) { appendChild(newRootShadowNode, child); } if (DEBUG) { FLog.d( TAG, "ReactShadowNodeHierarchy before calculateLayout: " + newRootShadowNode.getHierarchyInfo()); } notifyOnBeforeLayoutRecursive(newRootShadowNode); calculateLayout(newRootShadowNode); if (DEBUG) { FLog.d( TAG, "ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo()); } mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode); return newRootShadowNode; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 13
Source File: OrientationModule.java From react-native-orientation-locker with MIT License | 5 votes |
@Override public void onHostPause() { FLog.d(ReactConstants.TAG, "orientation detect disabled."); mOrientationListener.disable(); final Activity activity = getCurrentActivity(); if (activity == null) return; try { activity.unregisterReceiver(mReceiver); } catch (java.lang.IllegalArgumentException e) { FLog.w(ReactConstants.TAG, "Receiver already unregistered", e); } }
Example 14
Source File: AnimatedDrawableCachingBackendImpl.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override protected synchronized void finalize() throws Throwable { super.finalize(); if (mCachedBitmaps.size() > 0) { FLog.d(TAG, "Finalizing with rendered bitmaps"); } sTotalBitmaps.addAndGet(-mFreeBitmaps.size()); mFreeBitmaps.clear(); }
Example 15
Source File: HeifExifUtil.java From fresco with MIT License | 5 votes |
public static int getOrientation(final InputStream inputStream) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return HeifExifUtilAndroidN.getOrientation(inputStream); } else { FLog.d(TAG, "Trying to read Heif Exif information before Android N -> ignoring"); return ExifInterface.ORIENTATION_UNDEFINED; } }
Example 16
Source File: OrientationModule.java From react-native-orientation-locker with MIT License | 5 votes |
@Override public void onHostDestroy() { FLog.d(ReactConstants.TAG, "orientation detect disabled."); mOrientationListener.disable(); final Activity activity = getCurrentActivity(); if (activity == null) return; try { activity.unregisterReceiver(mReceiver); } catch (java.lang.IllegalArgumentException e) { FLog.w(ReactConstants.TAG, "Receiver already unregistered", e); } }
Example 17
Source File: FabricUIManager.java From react-native-GPay with MIT License | 5 votes |
/** Creates a new {@link ReactShadowNode} */ @Nullable @DoNotStrip public ReactShadowNode createNode( int reactTag, String viewName, int rootTag, ReadableNativeMap props, long eventTarget) { if (DEBUG) { FLog.d(TAG, "createNode \n\ttag: " + reactTag + "\n\tviewName: " + viewName + "\n\trootTag: " + rootTag + "\n\tprops: " + props); } try { ViewManager viewManager = mViewManagerRegistry.get(viewName); ReactShadowNode node = viewManager.createShadowNodeInstance(mReactApplicationContext); ReactShadowNode rootNode = getRootNode(rootTag); node.setRootTag(rootNode.getReactTag()); node.setViewClassName(viewName); node.setInstanceHandle(eventTarget); node.setReactTag(reactTag); node.setThemedContext(rootNode.getThemedContext()); ReactStylesDiffMap styles = updateProps(node, props); if (!node.isVirtual()) { mUIViewOperationQueue.enqueueCreateView( rootNode.getThemedContext(), reactTag, viewName, styles); } return node; } catch (Throwable t) { handleException(getRootNode(rootTag), t); return null; } }
Example 18
Source File: DebugBitmapAnimationFrameListener.java From fresco with MIT License | 5 votes |
private void logStatistics() { FLog.d( TAG, "Stats: cached=%s, reused=%s, created=%s, fallback=%s, dropped=%s, unknown=%s", mCachedCount, mReusedCount, mCreatedCount, mFallbackCount, mDroppedFrameCount, mUnknownCount); }
Example 19
Source File: DefaultDiskStorageSupplier.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@VisibleForTesting void createRootDirectoryIfNecessary(File rootDirectory) throws IOException { try { FileUtils.mkdirs(rootDirectory); } catch (FileUtils.CreateDirectoryException cde) { mCacheErrorLogger.logError( CacheErrorLogger.CacheErrorCategory.WRITE_CREATE_DIR, TAG, "createRootDirectoryIfNecessary", cde); throw cde; } FLog.d(TAG, "Created cache directory %s", rootDirectory.getAbsolutePath()); }
Example 20
Source File: ImageFilter.java From react-native-image-filter-kit with MIT License | 5 votes |
private void handleError( final @Nonnull Throwable error, final @Nullable Functor.Arity1<Integer> retry, final int retries ) { FLog.w(ReactConstants.TAG, "ImageFilterKit: " + error.toString()); MemoryTrimmer trimmer = MemoryTrimmer.getInstance(); if ( error instanceof TooManyBitmapsException && trimmer.isUsed() && retries < mClearCachesMaxRetries ) { FLog.d(ReactConstants.TAG, "ImageFilterKit: clearing caches ..."); trimmer.trim(); Fresco.getImagePipeline().clearCaches(); Task.delay(1, mFiltering.getToken()).continueWith(task -> { if (retry != null) { retry.call(retries + 1); } return null; }, UiThreadImmediateExecutorService.getInstance(), mFiltering.getToken()); } else { sendJSEvent(ImageFilterEvent.ON_FILTERING_ERROR, error.toString()); } }