Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: chrome/browser/android/compositor/compositor_view.cc

Issue 1371523003: Android: Don't destroy LayerTreeHost when Surface goes away (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/compositor/compositor_view.h" 5 #include "chrome/browser/android/compositor/compositor_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include <android/bitmap.h> 9 #include <android/bitmap.h>
10 #include <android/native_window_jni.h> 10 #include <android/native_window_jni.h>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 root_layer_->SetIsDrawable(true); 100 root_layer_->SetIsDrawable(true);
101 root_layer_->SetBackgroundColor(SK_ColorWHITE); 101 root_layer_->SetBackgroundColor(SK_ColorWHITE);
102 102
103 toolbar_layer_->layer()->SetHideLayerAndSubtree(true); 103 toolbar_layer_->layer()->SetHideLayerAndSubtree(true);
104 root_layer_->AddChild(toolbar_layer_->layer()); 104 root_layer_->AddChild(toolbar_layer_->layer());
105 } 105 }
106 106
107 CompositorView::~CompositorView() { 107 CompositorView::~CompositorView() {
108 content::BrowserChildProcessObserver::Remove(this); 108 content::BrowserChildProcessObserver::Remove(this);
109 tab_content_manager_->OnUIResourcesWereEvicted();
109 110
110 // Explicitly reset these scoped_ptrs here because otherwise we callbacks will 111 // Explicitly reset these scoped_ptrs here because otherwise we callbacks will
111 // try to access member variables during destruction. 112 // try to access member variables during destruction.
112 compositor_.reset(NULL); 113 compositor_.reset(NULL);
113 } 114 }
114 115
115 void CompositorView::Destroy(JNIEnv* env, jobject object) { 116 void CompositorView::Destroy(JNIEnv* env, jobject object) {
116 delete this; 117 delete this;
117 } 118 }
118 119
(...skipping 27 matching lines...) Expand all
146 } 147 }
147 148
148 void CompositorView::SurfaceCreated(JNIEnv* env, jobject object) { 149 void CompositorView::SurfaceCreated(JNIEnv* env, jobject object) {
149 compositor_->SetRootLayer(root_layer_); 150 compositor_->SetRootLayer(root_layer_);
150 current_surface_format_ = 0; 151 current_surface_format_ = 0;
151 } 152 }
152 153
153 void CompositorView::SurfaceDestroyed(JNIEnv* env, jobject object) { 154 void CompositorView::SurfaceDestroyed(JNIEnv* env, jobject object) {
154 compositor_->SetSurface(NULL); 155 compositor_->SetSurface(NULL);
155 current_surface_format_ = 0; 156 current_surface_format_ = 0;
157 tab_content_manager_->OnUIResourcesWereEvicted();
156 } 158 }
157 159
158 void CompositorView::SurfaceChanged(JNIEnv* env, 160 void CompositorView::SurfaceChanged(JNIEnv* env,
159 jobject object, 161 jobject object,
160 jint format, 162 jint format,
161 jint width, 163 jint width,
162 jint height, 164 jint height,
163 jobject surface) { 165 jobject surface) {
164 DCHECK(surface); 166 DCHECK(surface);
165 if (current_surface_format_ != format) { 167 if (current_surface_format_ != format) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // through here but through BrowserChildProcessHostDisconnected() instead. 324 // through here but through BrowserChildProcessHostDisconnected() instead.
323 } 325 }
324 326
325 // Register native methods 327 // Register native methods
326 bool RegisterCompositorView(JNIEnv* env) { 328 bool RegisterCompositorView(JNIEnv* env) {
327 return RegisterNativesImpl(env); 329 return RegisterNativesImpl(env);
328 } 330 }
329 331
330 } // namespace android 332 } // namespace android
331 } // namespace chrome 333 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698