Chromium Code Reviews| 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 "chrome/browser/ui/tab_contents/tab_contents.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 // happens to be already connected. | 200 // happens to be already connected. |
| 201 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 201 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 202 if (OneClickSigninHelper::CanOffer(contents, "", false)) | 202 if (OneClickSigninHelper::CanOffer(contents, "", false)) |
| 203 one_click_signin_helper_.reset(new OneClickSigninHelper(contents)); | 203 one_click_signin_helper_.reset(new OneClickSigninHelper(contents)); |
| 204 #endif | 204 #endif |
| 205 } | 205 } |
| 206 | 206 |
| 207 TabContents::~TabContents() { | 207 TabContents::~TabContents() { |
| 208 in_destructor_ = true; | 208 in_destructor_ = true; |
| 209 | 209 |
| 210 // Need to reset |thumbnail_generator_| here before |web_contents_| is | |
| 211 // deleted because destructing |web_contents_| can end up causing the | |
| 212 // thumbnailer to generate a thumbnail. Since TabContents can be | |
| 213 // destructed during shutdown, trying to generate a thumbnail by sending an | |
| 214 // IPC message to the GPU process is not safe. Sending | |
| 215 // chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED can also cause the thumbnailer | |
|
mazda
2012/08/30 17:19:18
I was forgetting that we need to deal with this ca
Avi (use Gerrit)
2012/08/30 18:16:26
Note that NOTIFICATION_TAB_CONTENTS_DESTROYED is g
mazda
2012/08/30 19:39:22
That's a great. Then WebContents::IsBeingDestroyed
| |
| 216 // to generate a thumbnail, so this must be placed before sending the | |
| 217 // notification. | |
| 218 thumbnail_generator_.reset(); | |
| 219 | |
| 220 content::NotificationService::current()->Notify( | 210 content::NotificationService::current()->Notify( |
| 221 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 211 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 222 content::Source<TabContents>(this), | 212 content::Source<TabContents>(this), |
| 223 content::NotificationService::NoDetails()); | 213 content::NotificationService::NoDetails()); |
| 224 | 214 |
| 225 // Need to tear down infobars before the WebContents goes away. | 215 // Need to tear down infobars before the WebContents goes away. |
| 226 // TODO(avi): Can we get this handled by the tab helper itself? | 216 // TODO(avi): Can we get this handled by the tab helper itself? |
| 227 infobar_tab_helper_.reset(); | 217 infobar_tab_helper_.reset(); |
| 228 } | 218 } |
| 229 | 219 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 #if defined(ENABLE_SESSION_SERVICE) | 266 #if defined(ENABLE_SESSION_SERVICE) |
| 277 SessionService* session = | 267 SessionService* session = |
| 278 SessionServiceFactory::GetForProfile(profile()); | 268 SessionServiceFactory::GetForProfile(profile()); |
| 279 if (session) { | 269 if (session) { |
| 280 session->SetTabUserAgentOverride(restore_tab_helper()->window_id(), | 270 session->SetTabUserAgentOverride(restore_tab_helper()->window_id(), |
| 281 restore_tab_helper()->session_id(), | 271 restore_tab_helper()->session_id(), |
| 282 user_agent); | 272 user_agent); |
| 283 } | 273 } |
| 284 #endif | 274 #endif |
| 285 } | 275 } |
| OLD | NEW |