| 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 |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 18 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 19 #include "cc/base/thread_impl.h" | |
| 20 #include "cc/input/input_handler.h" | 20 #include "cc/input/input_handler.h" |
| 21 #include "cc/layers/layer.h" | 21 #include "cc/layers/layer.h" |
| 22 #include "cc/output/context_provider.h" | 22 #include "cc/output/context_provider.h" |
| 23 #include "cc/output/output_surface.h" | 23 #include "cc/output/output_surface.h" |
| 24 #include "cc/trees/layer_tree_host.h" | 24 #include "cc/trees/layer_tree_host.h" |
| 25 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 25 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 26 #include "content/browser/gpu/gpu_surface_tracker.h" | 26 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 27 #include "content/browser/renderer_host/image_transport_factory_android.h" | 27 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 28 #include "content/common/gpu/client/gl_helper.h" | 28 #include "content/common/gpu/client/gl_helper.h" |
| 29 #include "content/common/gpu/client/gpu_channel_host.h" | 29 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 settings.calculate_top_controls_position = false; | 209 settings.calculate_top_controls_position = false; |
| 210 settings.top_controls_height = 0.f; | 210 settings.top_controls_height = 0.f; |
| 211 settings.use_memory_management = false; | 211 settings.use_memory_management = false; |
| 212 settings.highp_threshold_min = 2048; | 212 settings.highp_threshold_min = 2048; |
| 213 | 213 |
| 214 // Do not clear the framebuffer when rendering into external GL contexts | 214 // Do not clear the framebuffer when rendering into external GL contexts |
| 215 // like Android View System's. | 215 // like Android View System's. |
| 216 if (UsesDirectGL()) | 216 if (UsesDirectGL()) |
| 217 settings.should_clear_root_render_pass = false; | 217 settings.should_clear_root_render_pass = false; |
| 218 | 218 |
| 219 scoped_ptr<cc::Thread> impl_thread; | 219 scoped_refptr<base::SingleThreadTaskRunner> impl_thread_task_runner = |
| 220 if (g_impl_thread) | 220 g_impl_thread ? g_impl_thread->message_loop()->message_loop_proxy() |
| 221 impl_thread = cc::ThreadImpl::CreateForDifferentThread( | 221 : NULL; |
| 222 g_impl_thread->message_loop()->message_loop_proxy()); | |
| 223 | 222 |
| 224 host_ = cc::LayerTreeHost::Create(this, settings, impl_thread.Pass()); | 223 host_ = cc::LayerTreeHost::Create(this, settings, impl_thread_task_runner); |
| 225 host_->SetRootLayer(root_layer_); | 224 host_->SetRootLayer(root_layer_); |
| 226 | 225 |
| 227 host_->SetVisible(true); | 226 host_->SetVisible(true); |
| 228 host_->SetLayerTreeHostClientReady(); | 227 host_->SetLayerTreeHostClientReady(); |
| 229 host_->SetViewportSize(size_); | 228 host_->SetViewportSize(size_); |
| 230 host_->set_has_transparent_background(has_transparent_background_); | 229 host_->set_has_transparent_background(has_transparent_background_); |
| 231 } | 230 } |
| 232 } | 231 } |
| 233 | 232 |
| 234 void CompositorImpl::setDeviceScaleFactor(float factor) { | 233 void CompositorImpl::setDeviceScaleFactor(float factor) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 455 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
| 457 return GL_UNSIGNED_BYTE; | 456 return GL_UNSIGNED_BYTE; |
| 458 break; | 457 break; |
| 459 case ANDROID_BITMAP_FORMAT_RGB_565: | 458 case ANDROID_BITMAP_FORMAT_RGB_565: |
| 460 default: | 459 default: |
| 461 return GL_UNSIGNED_SHORT_5_6_5; | 460 return GL_UNSIGNED_SHORT_5_6_5; |
| 462 } | 461 } |
| 463 } | 462 } |
| 464 | 463 |
| 465 } // namespace content | 464 } // namespace content |
| OLD | NEW |