OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "android_webview/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 InProcessViewRenderer::~InProcessViewRenderer() { | 245 InProcessViewRenderer::~InProcessViewRenderer() { |
246 CHECK(web_contents_); | 246 CHECK(web_contents_); |
247 content::SynchronousCompositor::SetClientForWebContents(web_contents_, NULL); | 247 content::SynchronousCompositor::SetClientForWebContents(web_contents_, NULL); |
248 web_contents_->SetUserData(kUserDataKey, NULL); | 248 web_contents_->SetUserData(kUserDataKey, NULL); |
249 NoLongerExpectsDrawGL(); | 249 NoLongerExpectsDrawGL(); |
250 DCHECK(web_contents_ == NULL); // WebContentsGone should have been called. | 250 DCHECK(web_contents_ == NULL); // WebContentsGone should have been called. |
251 } | 251 } |
252 | 252 |
253 | |
254 // TODO(boliu): Should also call this when we know for sure we are no longer, | |
255 // for example, when visible rect becomes 0. | |
256 void InProcessViewRenderer::NoLongerExpectsDrawGL() { | 253 void InProcessViewRenderer::NoLongerExpectsDrawGL() { |
257 GLViewRendererManager& mru = g_view_renderer_manager.Get(); | 254 GLViewRendererManager& mru = g_view_renderer_manager.Get(); |
258 if (manager_key_ != mru.NullKey()) { | 255 if (manager_key_ != mru.NullKey()) { |
259 mru.NoLongerExpectsDrawGL(manager_key_); | 256 mru.NoLongerExpectsDrawGL(manager_key_); |
260 manager_key_ = mru.NullKey(); | 257 manager_key_ = mru.NullKey(); |
261 | |
262 // TODO(boliu): If this is the first one and there are GL pending, | |
263 // requestDrawGL on next one. | |
264 // TODO(boliu): If this is the last one, lose all global contexts. | |
265 } | 258 } |
266 } | 259 } |
267 | 260 |
268 // static | 261 // static |
269 InProcessViewRenderer* InProcessViewRenderer::FromWebContents( | 262 InProcessViewRenderer* InProcessViewRenderer::FromWebContents( |
270 content::WebContents* contents) { | 263 content::WebContents* contents) { |
271 return UserData::GetInstance(contents); | 264 return UserData::GetInstance(contents); |
272 } | 265 } |
273 | 266 |
274 void InProcessViewRenderer::WebContentsGone() { | 267 void InProcessViewRenderer::WebContentsGone() { |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 base::StringAppendF(&str, | 886 base::StringAppendF(&str, |
894 "surface width height: [%d %d] ", | 887 "surface width height: [%d %d] ", |
895 draw_info->width, | 888 draw_info->width, |
896 draw_info->height); | 889 draw_info->height); |
897 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 890 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
898 } | 891 } |
899 return str; | 892 return str; |
900 } | 893 } |
901 | 894 |
902 } // namespace android_webview | 895 } // namespace android_webview |
OLD | NEW |