当前位置: 首页>>代码示例>>Java>>正文


Java TraceEvent.instant方法代码示例

本文整理汇总了Java中org.chromium.content.common.TraceEvent.instant方法的典型用法代码示例。如果您正苦于以下问题:Java TraceEvent.instant方法的具体用法?Java TraceEvent.instant怎么用?Java TraceEvent.instant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.content.common.TraceEvent的用法示例。


在下文中一共展示了TraceEvent.instant方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VSyncMonitor

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
VSyncMonitor(Context context, VSyncMonitor.Listener listener, boolean enableJBVSync) {
    mListener = listener;
    float refreshRate = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE))
            .getDefaultDisplay().getRefreshRate();
    if (refreshRate <= 0) refreshRate = 60;
    mRefreshPeriodNano = (long) (NANOSECONDS_PER_SECOND / refreshRate);
    mTriggerNextVSyncCount = 0;

    if (enableJBVSync && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // Use Choreographer on JB+ to get notified of vsync.
        mChoreographer = Choreographer.getInstance();
        mVSyncFrameCallback = new Choreographer.FrameCallback() {
            @Override
            public void doFrame(long frameTimeNanos) {
                TraceEvent.instant("VSync");
                onVSyncCallback(frameTimeNanos);
            }
        };
        mHandler = null;
        mVSyncRunnableCallback = null;
    } else {
        // On ICS we just hope that running tasks is relatively predictable.
        mChoreographer = null;
        mVSyncFrameCallback = null;
        mHandler = new Handler();
        mVSyncRunnableCallback = new Runnable() {
            @Override
            public void run() {
                TraceEvent.instant("VSyncTimer");
                onVSyncCallback(System.nanoTime());
            }
        };
        mGoodStartingPointNano = getCurrentNanoTime();
        mLastPostedNano = 0;
    }
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:37,代码来源:VSyncMonitor.java

示例2: getVSyncListener

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
public VSyncManager.Listener getVSyncListener(VSyncManager.Provider vsyncProvider) {
    if (mVSyncProvider != null && mVSyncListenerRegistered) {
        mVSyncProvider.unregisterVSyncListener(mVSyncListener);
        mVSyncListenerRegistered = false;
    }

    mVSyncProvider = vsyncProvider;
    mVSyncListener = new VSyncManager.Listener() {
        @Override
        public void updateVSync(long tickTimeMicros, long intervalMicros) {
            if (mNativeContentViewCore != 0) {
                nativeUpdateVSyncParameters(mNativeContentViewCore, tickTimeMicros,
                        intervalMicros);
            }
        }

        @Override
        public void onVSync(long frameTimeMicros) {
            animateIfNecessary(frameTimeMicros);

            if (mDidSignalVSyncUsingInputEvent) {
                TraceEvent.instant("ContentViewCore::onVSync ignored");
                mDidSignalVSyncUsingInputEvent = false;
                return;
            }
            if (mNativeContentViewCore != 0) {
                nativeOnVSync(mNativeContentViewCore, frameTimeMicros);
            }
        }
    };

    if (mVSyncSubscriberCount > 0) {
        // setVSyncNotificationEnabled(true) is called before getVSyncListener.
        vsyncProvider.registerVSyncListener(mVSyncListener);
        mVSyncListenerRegistered = true;
    }

    return mVSyncListener;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:40,代码来源:ContentViewCore.java

示例3: getVSyncListener

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
public VSyncManager.Listener getVSyncListener(VSyncManager.Provider vsyncProvider) {
    if (mVSyncProvider != null && mVSyncListenerRegistered) {
        mVSyncProvider.unregisterVSyncListener(mVSyncListener);
        mVSyncListenerRegistered = false;
    }

    mVSyncProvider = vsyncProvider;
    mVSyncListener = new VSyncManager.Listener() {
        @Override
        public void updateVSync(long tickTimeMicros, long intervalMicros) {
            if (mNativeContentViewCore != 0) {
                nativeUpdateVSyncParameters(mNativeContentViewCore, tickTimeMicros,
                        intervalMicros);
            }
        }

        @Override
        public void onVSync(long frameTimeMicros) {
            animateIfNecessary(frameTimeMicros);

            if (mDidSignalVSyncUsingInputEvent) {
                TraceEvent.instant("ContentViewCore::onVSync ignored");
                mDidSignalVSyncUsingInputEvent = false;
                return;
            }
            if (mNativeContentViewCore != 0) {
                nativeOnVSync(mNativeContentViewCore, frameTimeMicros);
            }
        }
    };

    if (mVSyncSubscriberCount > 0) {
        // addVSyncSubscriber() is called before getVSyncListener.
        vsyncProvider.registerVSyncListener(mVSyncListener);
        mVSyncListenerRegistered = true;
    }

    return mVSyncListener;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:40,代码来源:ContentViewCore.java

示例4: onVSync

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
@Override
public void onVSync(VSyncMonitor monitor, long vsyncTimeMicros) {
    if (mNeedToRender) {
        if (mPendingSwapBuffers + mPendingRenders <= MAX_SWAP_BUFFER_COUNT) {
            mNeedToRender = false;
            mPendingRenders++;
            render();
        } else {
            TraceEvent.instant("ContentViewRenderView:bail");
        }
    }

    if (mVSyncListener != null) {
        if (mVSyncNotificationEnabled) {
            mVSyncListener.onVSync(vsyncTimeMicros);
            mVSyncMonitor.requestUpdate();
        } else {
            // Compensate for input event lag. Input events are delivered immediately on
            // pre-JB releases, so this adjustment is only done for later versions.
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                vsyncTimeMicros += INPUT_EVENT_LAG_FROM_VSYNC_MICROSECONDS;
            }
            mVSyncListener.updateVSync(vsyncTimeMicros,
                    mVSyncMonitor.getVSyncPeriodInMicroseconds());
        }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:28,代码来源:ContentViewRenderView.java

示例5: onSwapBuffersCompleted

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
@CalledByNative
private void onSwapBuffersCompleted() {
    TraceEvent.instant("onSwapBuffersCompleted");

    if (mPendingSwapBuffers == MAX_SWAP_BUFFER_COUNT && mNeedToRender) requestRender();
    if (mPendingSwapBuffers > 0) mPendingSwapBuffers--;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:ContentViewRenderView.java

示例6: updateFrameInfo

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@CalledByNative
private void updateFrameInfo(
        float scrollOffsetX, float scrollOffsetY,
        float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor,
        float contentWidth, float contentHeight,
        float viewportWidth, float viewportHeight,
        float controlsOffsetYCss, float contentOffsetYCss,
        float overdrawBottomHeightCss) {
    TraceEvent.instant("ContentViewCore:updateFrameInfo");
    // Adjust contentWidth/Height to be always at least as big as
    // the actual viewport (as set by onSizeChanged).
    contentWidth = Math.max(contentWidth,
            mRenderCoordinates.fromPixToLocalCss(mViewportWidthPix));
    contentHeight = Math.max(contentHeight,
            mRenderCoordinates.fromPixToLocalCss(mViewportHeightPix));

    final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentOffsetYCss);

    final boolean contentSizeChanged =
            contentWidth != mRenderCoordinates.getContentWidthCss()
            || contentHeight != mRenderCoordinates.getContentHeightCss();
    final boolean scaleLimitsChanged =
            minPageScaleFactor != mRenderCoordinates.getMinPageScaleFactor()
            || maxPageScaleFactor != mRenderCoordinates.getMaxPageScaleFactor();
    final boolean pageScaleChanged =
            pageScaleFactor != mRenderCoordinates.getPageScaleFactor();
    final boolean scrollChanged =
            pageScaleChanged
            || scrollOffsetX != mRenderCoordinates.getScrollX()
            || scrollOffsetY != mRenderCoordinates.getScrollY();
    final boolean contentOffsetChanged =
            contentOffsetYPix != mRenderCoordinates.getContentOffsetYPix();

    final boolean needHidePopupZoomer = contentSizeChanged || scrollChanged;
    final boolean needUpdateZoomControls = scaleLimitsChanged || scrollChanged;
    final boolean needTemporarilyHideHandles = scrollChanged;

    if (needHidePopupZoomer) mPopupZoomer.hide(true);

    if (pageScaleChanged) {
        // This function should be called back from native as soon
        // as the scroll is applied to the backbuffer.  We should only
        // update mNativeScrollX/Y here for consistency.
        getContentViewClient().onScaleChanged(
                mRenderCoordinates.getPageScaleFactor(), pageScaleFactor);
    }

    mRenderCoordinates.updateFrameInfo(
            scrollOffsetX, scrollOffsetY,
            contentWidth, contentHeight,
            viewportWidth, viewportHeight,
            pageScaleFactor, minPageScaleFactor, maxPageScaleFactor,
            contentOffsetYPix);

    if ((contentSizeChanged || pageScaleChanged) && mUpdateFrameInfoListener != null) {
        mUpdateFrameInfoListener.onFrameInfoUpdated(
                contentWidth, contentHeight, pageScaleFactor);
    }

    if (needTemporarilyHideHandles) temporarilyHideTextHandles();
    if (needUpdateZoomControls) mZoomControlsDelegate.updateZoomControls();
    if (contentOffsetChanged) updateHandleScreenPositions();

    // Update offsets for fullscreen.
    final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
    final float controlsOffsetPix = controlsOffsetYCss * deviceScale;
    final float overdrawBottomHeightPix = overdrawBottomHeightCss * deviceScale;
    getContentViewClient().onOffsetsForFullscreenChanged(
            controlsOffsetPix, contentOffsetYPix, overdrawBottomHeightPix);

    mPendingRendererFrame = true;
    if (mBrowserAccessibilityManager != null) {
        mBrowserAccessibilityManager.notifyFrameInfoInitialized();
    }

    // Update geometry for external video surface.
    getContentViewClient().onGeometryChanged(-1, null);
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:80,代码来源:ContentViewCore.java

示例7: confirmTouchEvent

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
/**
 * Respond to a MotionEvent being returned from the native side.
 * @param ackResult The status acknowledgment code.
 */
void confirmTouchEvent(int ackResult) {
    if (mTouchEventTimeoutHandler.confirmTouchEvent()) return;
    if (mPendingMotionEvents.isEmpty()) {
        Log.w(TAG, "confirmTouchEvent with Empty pending list!");
        return;
    }
    TraceEvent.begin("confirmTouchEvent");
    MotionEvent ackedEvent = mPendingMotionEvents.removeFirst();
    if (ackedEvent == mLastCancelledEvent) {
        // The event is canceled, just drain all the pending events until next
        // touch down.
        ackResult = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
        TraceEvent.instant("confirmTouchEvent:CanceledEvent");
    }
    switch (ackResult) {
        case INPUT_EVENT_ACK_STATE_UNKNOWN:
            // This should never get sent.
            assert(false);
            break;
        case INPUT_EVENT_ACK_STATE_CONSUMED:
            mJavaScriptIsConsumingGesture = true;
            mZoomManager.passTouchEventThrough(ackedEvent);
            trySendPendingEventsToNative();
            break;
        case INPUT_EVENT_ACK_STATE_NOT_CONSUMED:
            if (!mJavaScriptIsConsumingGesture) processTouchEvent(ackedEvent);
            trySendPendingEventsToNative();
            break;
        case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS:
            mNoTouchHandlerForGesture = true;
            processTouchEvent(ackedEvent);
            drainAllPendingEventsUntilNextDown();
            break;
        default:
            break;
    }

    mLongPressDetector.cancelLongPressIfNeeded(mPendingMotionEvents.iterator());

    recycleEvent(ackedEvent);
    TraceEvent.end("confirmTouchEvent");
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:47,代码来源:ContentViewGestureHandler.java

示例8: updateFrameInfo

import org.chromium.content.common.TraceEvent; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@CalledByNative
private void updateFrameInfo(
        float scrollOffsetX, float scrollOffsetY,
        float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor,
        float contentWidth, float contentHeight,
        float viewportWidth, float viewportHeight,
        float controlsOffsetYCss, float contentOffsetYCss,
        float overdrawBottomHeightCss) {
    TraceEvent.instant("ContentViewCore:updateFrameInfo");
    // Adjust contentWidth/Height to be always at least as big as
    // the actual viewport (as set by onSizeChanged).
    contentWidth = Math.max(contentWidth,
            mRenderCoordinates.fromPixToLocalCss(mViewportWidthPix));
    contentHeight = Math.max(contentHeight,
            mRenderCoordinates.fromPixToLocalCss(mViewportHeightPix));

    final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentOffsetYCss);

    final boolean contentSizeChanged =
            contentWidth != mRenderCoordinates.getContentWidthCss()
            || contentHeight != mRenderCoordinates.getContentHeightCss();
    final boolean scaleLimitsChanged =
            minPageScaleFactor != mRenderCoordinates.getMinPageScaleFactor()
            || maxPageScaleFactor != mRenderCoordinates.getMaxPageScaleFactor();
    final boolean pageScaleChanged =
            pageScaleFactor != mRenderCoordinates.getPageScaleFactor();
    final boolean scrollChanged =
            pageScaleChanged
            || scrollOffsetX != mRenderCoordinates.getScrollX()
            || scrollOffsetY != mRenderCoordinates.getScrollY();
    final boolean contentOffsetChanged =
            contentOffsetYPix != mRenderCoordinates.getContentOffsetYPix();

    final boolean needHidePopupZoomer = contentSizeChanged || scrollChanged;
    final boolean needUpdateZoomControls = scaleLimitsChanged || scrollChanged;
    final boolean needTemporarilyHideHandles = scrollChanged;

    if (needHidePopupZoomer) mPopupZoomer.hide(true);

    if (scrollChanged) {
        mContainerViewInternals.onScrollChanged(
                (int) mRenderCoordinates.fromLocalCssToPix(scrollOffsetX),
                (int) mRenderCoordinates.fromLocalCssToPix(scrollOffsetY),
                (int) mRenderCoordinates.getScrollXPix(),
                (int) mRenderCoordinates.getScrollYPix());
    }

    mRenderCoordinates.updateFrameInfo(
            scrollOffsetX, scrollOffsetY,
            contentWidth, contentHeight,
            viewportWidth, viewportHeight,
            pageScaleFactor, minPageScaleFactor, maxPageScaleFactor,
            contentOffsetYPix);
    onRenderCoordinatesUpdated();

    if (needTemporarilyHideHandles) temporarilyHideTextHandles();
    if (needUpdateZoomControls) mZoomControlsDelegate.updateZoomControls();
    if (contentOffsetChanged) updateHandleScreenPositions();

    // Update offsets for fullscreen.
    final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
    final float controlsOffsetPix = controlsOffsetYCss * deviceScale;
    final float overdrawBottomHeightPix = overdrawBottomHeightCss * deviceScale;
    getContentViewClient().onOffsetsForFullscreenChanged(
            controlsOffsetPix, contentOffsetYPix, overdrawBottomHeightPix);

    mPendingRendererFrame = true;
    if (mBrowserAccessibilityManager != null) {
        mBrowserAccessibilityManager.notifyFrameInfoInitialized();
    }

    // Update geometry for external video surface.
    getContentViewClient().onGeometryChanged(-1, null);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:76,代码来源:ContentViewCore.java


注:本文中的org.chromium.content.common.TraceEvent.instant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。