EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.android_webview]

COVERAGE SUMMARY FOR SOURCE FILE [AwPicture.java]

nameclass, %method, %block, %line, %
AwPicture.java0%   (0/3)0%   (0/12)0%   (0/85)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AwPicture0%   (0/1)0%   (0/9)0%   (0/71)0%   (0/17)
AwPicture (int): void 0%   (0/1)0%   (0/22)0%   (0/5)
access$000 (int): void 0%   (0/1)0%   (0/3)0%   (0/1)
beginRecording (int, int): Canvas 0%   (0/1)0%   (0/4)0%   (0/2)
draw (Canvas): void 0%   (0/1)0%   (0/23)0%   (0/3)
endRecording (): void 0%   (0/1)0%   (0/1)0%   (0/1)
getHeight (): int 0%   (0/1)0%   (0/5)0%   (0/1)
getWidth (): int 0%   (0/1)0%   (0/5)0%   (0/1)
unsupportedOperation (): void 0%   (0/1)0%   (0/5)0%   (0/1)
writeToStream (OutputStream): void 0%   (0/1)0%   (0/3)0%   (0/2)
     
class AwPicture$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class AwPicture$DestroyRunnable0%   (0/1)0%   (0/3)0%   (0/14)0%   (0/6)
AwPicture$DestroyRunnable (int): void 0%   (0/1)0%   (0/6)0%   (0/3)
AwPicture$DestroyRunnable (int, AwPicture$1): void 0%   (0/1)0%   (0/4)0%   (0/1)
run (): void 0%   (0/1)0%   (0/4)0%   (0/2)

1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4 
5package org.chromium.android_webview;
6 
7import android.graphics.Canvas;
8import android.graphics.Picture;
9import android.graphics.Rect;
10 
11import org.chromium.base.CalledByNative;
12import org.chromium.base.JNINamespace;
13import org.chromium.content.common.CleanupReference;
14 
15import java.io.OutputStream;
16 
17// A simple wrapper around a SkPicture, that allows final rendering to be performed using the
18// chromium skia library.
19@JNINamespace("android_webview")
20class AwPicture extends Picture {
21 
22    private int mNativeAwPicture;
23 
24    // There is no explicit destroy method on Picture base-class, so cleanup is always
25    // handled via the CleanupReference.
26    private static final class DestroyRunnable implements Runnable {
27        private int mNativeAwPicture;
28        private DestroyRunnable(int nativeAwPicture) {
29            mNativeAwPicture = nativeAwPicture;
30        }
31        @Override
32        public void run() {
33            nativeDestroy(mNativeAwPicture);
34        }
35    }
36 
37    private CleanupReference mCleanupReference;
38 
39    /**
40     * @param nativeAwPicture is an instance of the AwPicture native class. Ownership is
41     *                        taken by this java instance.
42     */
43    AwPicture(int nativeAwPicture) {
44        mNativeAwPicture = nativeAwPicture;
45        mCleanupReference = new CleanupReference(this, new DestroyRunnable(nativeAwPicture));
46    }
47 
48    @Override
49    public Canvas beginRecording(int width, int height) {
50        unsupportedOperation();
51        return null;
52    }
53 
54    @Override
55    public void endRecording() {
56        // Intentional no-op. The native picture ended recording prior to java c'tor call.
57    }
58 
59    @Override
60    public int getWidth() {
61        return nativeGetWidth(mNativeAwPicture);
62    }
63 
64    @Override
65    public int getHeight() {
66        return nativeGetHeight(mNativeAwPicture);
67    }
68 
69    // Effectively a local variable of draw(), but held as a member to avoid GC churn.
70    private Rect mClipBoundsTemporary = new Rect();
71 
72    @Override
73    public void draw(Canvas canvas) {
74        canvas.getClipBounds(mClipBoundsTemporary);
75        nativeDraw(mNativeAwPicture, canvas,
76                mClipBoundsTemporary.left, mClipBoundsTemporary.top,
77                mClipBoundsTemporary.right, mClipBoundsTemporary.bottom);
78    }
79 
80    @Override
81    public void writeToStream(OutputStream stream) {
82        unsupportedOperation();
83    }
84 
85    private void unsupportedOperation() {
86        throw new IllegalStateException("Unsupported in AwPicture");
87    }
88 
89    private static native void nativeDestroy(int nativeAwPicture);
90    private native int nativeGetWidth(int nativeAwPicture);
91    private native int nativeGetHeight(int nativeAwPicture);
92    private native void nativeDraw(int nativeAwPicture, Canvas canvas,
93            int left, int top, int right, int bottom);
94}
95 

[all classes][org.chromium.android_webview]
EMMA 2.0.5312 (C) Vladimir Roubtsov