| 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/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" | 
| 6 | 6 | 
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> | 
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> | 
| 9 #include <map> | 9 #include <map> | 
| 10 | 10 | 
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 354   if (surface_id_) { | 354   if (surface_id_) { | 
| 355     DCHECK(g_surface_map.Get().find(surface_id_) != | 355     DCHECK(g_surface_map.Get().find(surface_id_) != | 
| 356            g_surface_map.Get().end()); | 356            g_surface_map.Get().end()); | 
| 357     base::AutoLock lock(g_surface_map_lock.Get()); | 357     base::AutoLock lock(g_surface_map_lock.Get()); | 
| 358     g_surface_map.Get().erase(surface_id_); | 358     g_surface_map.Get().erase(surface_id_); | 
| 359   } | 359   } | 
| 360   SetWindowSurface(NULL); | 360   SetWindowSurface(NULL); | 
| 361 | 361 | 
| 362   // Now, set the new surface if we have one. | 362   // Now, set the new surface if we have one. | 
| 363   ANativeWindow* window = NULL; | 363   ANativeWindow* window = NULL; | 
| 364   if (surface) | 364   if (surface) { | 
|  | 365     // Note: This ensures that any local references used by | 
|  | 366     // ANativeWindow_fromSurface are released immediately. This is needed as a | 
|  | 367     // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 
|  | 368     base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 
| 365     window = ANativeWindow_fromSurface(env, surface); | 369     window = ANativeWindow_fromSurface(env, surface); | 
|  | 370   } | 
| 366   if (window) { | 371   if (window) { | 
| 367     SetWindowSurface(window); | 372     SetWindowSurface(window); | 
| 368     ANativeWindow_release(window); | 373     ANativeWindow_release(window); | 
| 369     { | 374     { | 
| 370       base::AutoLock lock(g_surface_map_lock.Get()); | 375       base::AutoLock lock(g_surface_map_lock.Get()); | 
| 371       g_surface_map.Get().insert(std::make_pair(surface_id_, j_surface)); | 376       g_surface_map.Get().insert(std::make_pair(surface_id_, j_surface)); | 
| 372     } | 377     } | 
| 373   } | 378   } | 
| 374 } | 379 } | 
| 375 | 380 | 
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 586 | 591 | 
| 587 void CompositorImpl::DidCommit() { | 592 void CompositorImpl::DidCommit() { | 
| 588   root_window_->OnCompositingDidCommit(); | 593   root_window_->OnCompositingDidCommit(); | 
| 589 } | 594 } | 
| 590 | 595 | 
| 591 void CompositorImpl::AttachLayerForReadback(scoped_refptr<cc::Layer> layer) { | 596 void CompositorImpl::AttachLayerForReadback(scoped_refptr<cc::Layer> layer) { | 
| 592   root_layer_->AddChild(layer); | 597   root_layer_->AddChild(layer); | 
| 593 } | 598 } | 
| 594 | 599 | 
| 595 }  // namespace content | 600 }  // namespace content | 
| OLD | NEW | 
|---|