| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "content/browser/android/content_view_render_view.h" |    5 #include "content/browser/android/content_view_render_view.h" | 
|    6  |    6  | 
|    7 #include "base/android/jni_android.h" |    7 #include "base/android/jni_android.h" | 
|    8 #include "base/android/jni_string.h" |    8 #include "base/android/jni_string.h" | 
|    9 #include "base/android/scoped_java_ref.h" |    9 #include "base/android/scoped_java_ref.h" | 
|   10 #include "base/bind.h" |   10 #include "base/bind.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50  |   50  | 
|   51 void ContentViewRenderView::SetCurrentContentView( |   51 void ContentViewRenderView::SetCurrentContentView( | 
|   52     JNIEnv* env, jobject obj, int native_content_view) { |   52     JNIEnv* env, jobject obj, int native_content_view) { | 
|   53   InitCompositor(); |   53   InitCompositor(); | 
|   54   ContentViewCoreImpl* content_view = |   54   ContentViewCoreImpl* content_view = | 
|   55       reinterpret_cast<ContentViewCoreImpl*>(native_content_view); |   55       reinterpret_cast<ContentViewCoreImpl*>(native_content_view); | 
|   56   if (content_view) |   56   if (content_view) | 
|   57     compositor_->SetRootLayer(content_view->GetLayer()); |   57     compositor_->SetRootLayer(content_view->GetLayer()); | 
|   58   else |   58   else | 
|   59     compositor_->SetRootLayer(cc::Layer::Create()); |   59     compositor_->SetRootLayer(cc::Layer::Create()); | 
 |   60  | 
 |   61   content_view->SetCompositor(compositor_.get()); | 
|   60 } |   62 } | 
|   61  |   63  | 
|   62 void ContentViewRenderView::SurfaceCreated( |   64 void ContentViewRenderView::SurfaceCreated( | 
|   63     JNIEnv* env, jobject obj, jobject jsurface) { |   65     JNIEnv* env, jobject obj, jobject jsurface) { | 
|   64   InitCompositor(); |   66   InitCompositor(); | 
|   65   compositor_->SetSurface(jsurface); |   67   compositor_->SetSurface(jsurface); | 
|   66 } |   68 } | 
|   67  |   69  | 
|   68 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { |   70 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { | 
|   69   compositor_->SetSurface(NULL); |   71   compositor_->SetSurface(NULL); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   96   JNIEnv* env = base::android::AttachCurrentThread(); |   98   JNIEnv* env = base::android::AttachCurrentThread(); | 
|   97   Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); |   99   Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); | 
|   98 } |  100 } | 
|   99  |  101  | 
|  100 void ContentViewRenderView::InitCompositor() { |  102 void ContentViewRenderView::InitCompositor() { | 
|  101   if (!compositor_) |  103   if (!compositor_) | 
|  102     compositor_.reset(Compositor::Create(this)); |  104     compositor_.reset(Compositor::Create(this)); | 
|  103 } |  105 } | 
|  104  |  106  | 
|  105 }  // namespace content |  107 }  // namespace content | 
| OLD | NEW |