Java Code Examples for org.chromium.base.TraceEvent#instant()

The following examples show how to use org.chromium.base.TraceEvent#instant() . 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: CompositorViewHolder.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onSwapBuffersCompleted(int pendingSwapBuffersCount) {
    TraceEvent.instant("onSwapBuffersCompleted");

    // Wait until the second frame to turn off the placeholder background on
    // tablets so the tab strip has time to start drawing.
    final ViewGroup controlContainer = (ViewGroup) mControlContainer;
    if (controlContainer != null && controlContainer.getBackground() != null && mHasDrawnOnce) {
        post(new Runnable() {
            @Override
            public void run() {
                controlContainer.setBackgroundResource(0);
            }
        });
    }

    mHasDrawnOnce = true;

    mPendingSwapBuffersCount = pendingSwapBuffersCount;

    if (!mSkipInvalidation || pendingSwapBuffersCount == 0) flushInvalidation();
    mSkipInvalidation = !mSkipInvalidation;
}
 
Example 2
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onSwapBuffersCompleted(int pendingSwapBuffersCount) {
    TraceEvent.instant("onSwapBuffersCompleted");

    // Wait until the second frame to turn off the placeholder background on
    // tablets so the tab strip has time to start drawing.
    final ViewGroup controlContainer = (ViewGroup) mControlContainer;
    if (controlContainer != null && controlContainer.getBackground() != null && mHasDrawnOnce) {
        post(new Runnable() {
            @Override
            public void run() {
                controlContainer.setBackgroundResource(0);
            }
        });
    }

    mHasDrawnOnce = true;

    mPendingSwapBuffersCount = pendingSwapBuffersCount;

    if (!mSkipInvalidation || pendingSwapBuffersCount == 0) flushInvalidation();
    mSkipInvalidation = !mSkipInvalidation;
}
 
Example 3
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void didSwapFrame(int pendingFrameCount) {
    TraceEvent.instant("didSwapFrame");

    // Wait until the second frame to turn off the placeholder background on
    // tablets so the tab strip has time to start drawing.
    final ViewGroup controlContainer = (ViewGroup) mControlContainer;
    if (controlContainer != null && controlContainer.getBackground() != null && mHasDrawnOnce) {
        post(new Runnable() {
            @Override
            public void run() {
                controlContainer.setBackgroundResource(0);
            }
        });
    }

    mHasDrawnOnce = true;

    mPendingFrameCount = pendingFrameCount;

    if (!mSkipInvalidation || pendingFrameCount == 0) flushInvalidation();
    mSkipInvalidation = !mSkipInvalidation;
}
 
Example 4
Source File: CompositorViewHolder.java    From delion with Apache License 2.0 5 votes vote down vote up
private void flushInvalidation() {
    if (mPendingInvalidations.isEmpty()) return;
    TraceEvent.instant("CompositorViewHolder.flushInvalidation");
    for (int i = 0; i < mPendingInvalidations.size(); i++) {
        mPendingInvalidations.get(i).doInvalidate();
    }
    mPendingInvalidations.clear();
}
 
Example 5
Source File: ChromeFullscreenManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private void applyMarginToFullChildViews(ViewGroup contentView, float margin) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();

        if (layoutParams.height == LayoutParams.MATCH_PARENT
                && layoutParams.topMargin != (int) margin) {
            layoutParams.topMargin = (int) margin;
            child.requestLayout();
            TraceEvent.instant("FullscreenManager:child.requestLayout()");
        }
    }
}
 
Example 6
Source File: ChromeFullscreenManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private void applyTranslationToTopChildViews(ViewGroup contentView, float translation) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;

        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();
        if (Gravity.TOP == (layoutParams.gravity & Gravity.FILL_VERTICAL)) {
            child.setTranslationY(translation);
            TraceEvent.instant("FullscreenManager:child.setTranslationY()");
        }
    }
}
 
Example 7
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void flushInvalidation() {
    if (mPendingInvalidations.isEmpty()) return;
    TraceEvent.instant("CompositorViewHolder.flushInvalidation");
    for (int i = 0; i < mPendingInvalidations.size(); i++) {
        mPendingInvalidations.get(i).doInvalidate();
    }
    mPendingInvalidations.clear();
}
 
Example 8
Source File: ChromeFullscreenManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void applyMarginToFullChildViews(ViewGroup contentView, float margin) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();

        if (layoutParams.height == LayoutParams.MATCH_PARENT
                && layoutParams.topMargin != (int) margin) {
            layoutParams.topMargin = (int) margin;
            child.requestLayout();
            TraceEvent.instant("FullscreenManager:child.requestLayout()");
        }
    }
}
 
Example 9
Source File: ChromeFullscreenManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void applyTranslationToTopChildViews(ViewGroup contentView, float translation) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;

        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();
        if (Gravity.TOP == (layoutParams.gravity & Gravity.FILL_VERTICAL)) {
            child.setTranslationY(translation);
            TraceEvent.instant("FullscreenManager:child.setTranslationY()");
        }
    }
}
 
Example 10
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void flushInvalidation() {
    if (mPendingInvalidations.isEmpty()) return;
    TraceEvent.instant("CompositorViewHolder.flushInvalidation");
    for (int i = 0; i < mPendingInvalidations.size(); i++) {
        mPendingInvalidations.get(i).doInvalidate();
    }
    mPendingInvalidations.clear();
}
 
Example 11
Source File: ChromeFullscreenManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void applyMarginToFullChildViews(ViewGroup contentView, float margin) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();

        if (layoutParams.height == LayoutParams.MATCH_PARENT
                && layoutParams.topMargin != (int) margin) {
            layoutParams.topMargin = (int) margin;
            child.requestLayout();
            TraceEvent.instant("FullscreenManager:child.requestLayout()");
        }
    }
}
 
Example 12
Source File: ChromeFullscreenManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void applyTranslationToTopChildViews(ViewGroup contentView, float translation) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;

        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();
        if (Gravity.TOP == (layoutParams.gravity & Gravity.FILL_VERTICAL)) {
            child.setTranslationY(translation);
            TraceEvent.instant("FullscreenManager:child.setTranslationY()");
        }
    }
}