Don't reset the database when there was an I/O error.
[chromium-blink-merge.git] / android_webview / native / java_browser_view_renderer_helper.cc
blobb72e037e99891f29fc5e85c7c181c6fcffaf7eb3
1 // Copyright (c) 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.
5 #include "android_webview/native/java_browser_view_renderer_helper.h"
7 #include "base/debug/trace_event.h"
8 #include "jni/JavaBrowserViewRendererHelper_jni.h"
10 using base::android::JavaRef;
11 using base::android::ScopedJavaLocalRef;
13 namespace android_webview {
15 JavaBrowserViewRendererHelper::JavaBrowserViewRendererHelper() {
18 JavaBrowserViewRendererHelper::~JavaBrowserViewRendererHelper() {
21 // static
22 JavaBrowserViewRendererHelper* JavaBrowserViewRendererHelper::GetInstance() {
23 static JavaBrowserViewRendererHelper* g_instance =
24 new JavaBrowserViewRendererHelper;
25 return g_instance;
28 ScopedJavaLocalRef<jobject> JavaBrowserViewRendererHelper::CreateBitmap(
29 JNIEnv* env,
30 int width,
31 int height,
32 const base::android::JavaRef<jobject>& jcanvas,
33 void* owner_key) {
34 TRACE_EVENT0("android_webview", "RendererHelper::CreateBitmap");
35 return width <= 0 || height <= 0 ? ScopedJavaLocalRef<jobject>() :
36 Java_JavaBrowserViewRendererHelper_createBitmap(
37 env, width, height, jcanvas.obj(),
38 reinterpret_cast<jint>(owner_key));
41 void JavaBrowserViewRendererHelper::DrawBitmapIntoCanvas(
42 JNIEnv* env,
43 const JavaRef<jobject>& jbitmap,
44 const JavaRef<jobject>& jcanvas,
45 int x,
46 int y) {
47 TRACE_EVENT0("android_webview", "RendererHelper::DrawBitmapIntoCanvas");
48 Java_JavaBrowserViewRendererHelper_drawBitmapIntoCanvas(
49 env, jbitmap.obj(), jcanvas.obj(), x, y);
52 ScopedJavaLocalRef<jobject>
53 JavaBrowserViewRendererHelper::RecordBitmapIntoPicture(
54 JNIEnv* env,
55 const JavaRef<jobject>& jbitmap) {
56 TRACE_EVENT0("android_webview", "RendererHelper::RecordBitmapIntoPicture");
57 return Java_JavaBrowserViewRendererHelper_recordBitmapIntoPicture(
58 env, jbitmap.obj());
61 bool RegisterJavaBrowserViewRendererHelper(JNIEnv* env) {
62 return RegisterNativesImpl(env) >= 0;
65 } // namespace android_webview