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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (WebKit::Platform::current() == NULL) { | 99 if (WebKit::Platform::current() == NULL) { |
100 LOG(WARNING) << "CompositorImpl(Android)::Initialize(): WebKit::Platform " | 100 LOG(WARNING) << "CompositorImpl(Android)::Initialize(): WebKit::Platform " |
101 << "is not initialized, COMPOSITOR IS NOT INITIALIZED " | 101 << "is not initialized, COMPOSITOR IS NOT INITIALIZED " |
102 << "(this is OK and expected if you're running Android" | 102 << "(this is OK and expected if you're running Android" |
103 << "WebView tests)."; | 103 << "WebView tests)."; |
104 // We only ever want to run this hack in single process mode. | 104 // We only ever want to run this hack in single process mode. |
105 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 105 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
106 switches::kSingleProcess)); | 106 switches::kSingleProcess)); |
107 return; | 107 return; |
108 } | 108 } |
| 109 #if 0 |
109 WebKit::Platform::current()->compositorSupport()->initialize(NULL); | 110 WebKit::Platform::current()->compositorSupport()->initialize(NULL); |
| 111 #endif |
110 } | 112 } |
111 | 113 |
112 // static | 114 // static |
113 bool CompositorImpl::IsInitialized() { | 115 bool CompositorImpl::IsInitialized() { |
114 return g_initialized; | 116 return g_initialized; |
115 } | 117 } |
116 | 118 |
117 CompositorImpl::CompositorImpl(Compositor::Client* client) | 119 CompositorImpl::CompositorImpl(Compositor::Client* client) |
118 : window_(NULL), | 120 : window_(NULL), |
119 surface_id_(0), | 121 surface_id_(0), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 tracker->SetSurfaceHandle( | 156 tracker->SetSurfaceHandle( |
155 surface_id_, | 157 surface_id_, |
156 gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false)); | 158 gfx::GLSurfaceHandle(gfx::kDummyPluginWindow, false)); |
157 | 159 |
158 DCHECK(!host_.get()); | 160 DCHECK(!host_.get()); |
159 WebKit::WebLayerTreeView::Settings settings; | 161 WebKit::WebLayerTreeView::Settings settings; |
160 settings.refreshRate = 60.0; | 162 settings.refreshRate = 60.0; |
161 WebKit::WebCompositorSupport* compositor_support = | 163 WebKit::WebCompositorSupport* compositor_support = |
162 WebKit::Platform::current()->compositorSupport(); | 164 WebKit::Platform::current()->compositorSupport(); |
163 host_.reset( | 165 host_.reset( |
164 compositor_support->createLayerTreeView(this, *root_layer_, settings)); | 166 compositor_support->createLayerTreeView(this, *root_layer_, settings, |
| 167 NULL)); |
165 host_->setVisible(true); | 168 host_->setVisible(true); |
166 host_->setSurfaceReady(); | 169 host_->setSurfaceReady(); |
167 host_->setViewportSize(size_); | 170 host_->setViewportSize(size_); |
168 } | 171 } |
169 } | 172 } |
170 | 173 |
171 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { | 174 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { |
172 if (size_ == size) | 175 if (size_ == size) |
173 return; | 176 return; |
174 | 177 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 333 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
331 return GL_UNSIGNED_BYTE; | 334 return GL_UNSIGNED_BYTE; |
332 break; | 335 break; |
333 case ANDROID_BITMAP_FORMAT_RGB_565: | 336 case ANDROID_BITMAP_FORMAT_RGB_565: |
334 default: | 337 default: |
335 return GL_UNSIGNED_SHORT_5_6_5; | 338 return GL_UNSIGNED_SHORT_5_6_5; |
336 } | 339 } |
337 } | 340 } |
338 | 341 |
339 } // namespace content | 342 } // namespace content |
OLD | NEW |