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/unload_controller.h" | 5 #include "chrome/browser/ui/unload_controller.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // TODO(ojan): We should add a call to browser_shutdown::OnShutdownStarting | 313 // TODO(ojan): We should add a call to browser_shutdown::OnShutdownStarting |
314 // somewhere around here so that we have accurate measurements of shutdown | 314 // somewhere around here so that we have accurate measurements of shutdown |
315 // time. | 315 // time. |
316 // TODO(ojan): We can probably fire all the unload events in parallel and | 316 // TODO(ojan): We can probably fire all the unload events in parallel and |
317 // get a perf benefit from that in the cases where the tab hangs in it's | 317 // get a perf benefit from that in the cases where the tab hangs in it's |
318 // unload handler or takes a long time to page in. | 318 // unload handler or takes a long time to page in. |
319 content::WebContents* web_contents = *(tabs_needing_unload_fired_.begin()); | 319 content::WebContents* web_contents = *(tabs_needing_unload_fired_.begin()); |
320 // Null check render_view_host here as this gets called on a PostTask and | 320 // Null check render_view_host here as this gets called on a PostTask and |
321 // the tab's render_view_host may have been nulled out. | 321 // the tab's render_view_host may have been nulled out. |
322 if (web_contents->GetRenderViewHost()) { | 322 if (web_contents->GetRenderViewHost()) { |
323 web_contents->GetRenderViewHost()->ClosePage(); | 323 web_contents->ClosePage(); |
324 } else { | 324 } else { |
325 ClearUnloadState(web_contents, true); | 325 ClearUnloadState(web_contents, true); |
326 } | 326 } |
327 } else { | 327 } else { |
328 NOTREACHED(); | 328 NOTREACHED(); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 bool UnloadController::HasCompletedUnloadProcessing() const { | 332 bool UnloadController::HasCompletedUnloadProcessing() const { |
333 return is_attempting_to_close_browser_ && | 333 return is_attempting_to_close_browser_ && |
(...skipping 24 matching lines...) Expand all Loading... |
358 } else { | 358 } else { |
359 base::MessageLoop::current()->PostTask( | 359 base::MessageLoop::current()->PostTask( |
360 FROM_HERE, | 360 FROM_HERE, |
361 base::Bind(&UnloadController::ProcessPendingTabs, | 361 base::Bind(&UnloadController::ProcessPendingTabs, |
362 weak_factory_.GetWeakPtr())); | 362 weak_factory_.GetWeakPtr())); |
363 } | 363 } |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 } // namespace chrome | 367 } // namespace chrome |
OLD | NEW |