| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 void PrerenderContents::OnRenderViewGone(int status, int exit_code) { | 676 void PrerenderContents::OnRenderViewGone(int status, int exit_code) { |
| 677 Destroy(FINAL_STATUS_RENDERER_CRASHED); | 677 Destroy(FINAL_STATUS_RENDERER_CRASHED); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void PrerenderContents::DidStopLoading() { | 680 void PrerenderContents::DidStopLoading() { |
| 681 has_stopped_loading_ = true; | 681 has_stopped_loading_ = true; |
| 682 } | 682 } |
| 683 | 683 |
| 684 void PrerenderContents::Destroy(FinalStatus final_status) { | 684 void PrerenderContents::Destroy(FinalStatus final_status) { |
| 685 if (prerender_manager_->IsPendingDelete(this)) | 685 if (!prerender_manager_->MoveEntryToPendingDelete(this)) |
| 686 return; | 686 return; |
| 687 | 687 |
| 688 prerender_manager_->MoveEntryToPendingDelete(this); | |
| 689 set_final_status(final_status); | 688 set_final_status(final_status); |
| 690 // We may destroy the PrerenderContents before we have initialized the | 689 // We may destroy the PrerenderContents before we have initialized the |
| 691 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to | 690 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to |
| 692 // avoid any more messages being sent. | 691 // avoid any more messages being sent. |
| 693 if (render_view_host_observer_.get()) | 692 if (render_view_host_observer_.get()) |
| 694 render_view_host_observer_->set_prerender_contents(NULL); | 693 render_view_host_observer_->set_prerender_contents(NULL); |
| 695 } | 694 } |
| 696 | 695 |
| 697 void PrerenderContents::RendererUnresponsive(RenderViewHost* render_view_host, | 696 void PrerenderContents::RendererUnresponsive(RenderViewHost* render_view_host, |
| 698 bool is_during_unload) { | 697 bool is_during_unload) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 // used. | 757 // used. |
| 759 if (UseTabContents()) { | 758 if (UseTabContents()) { |
| 760 if (!prerender_contents_.get()) | 759 if (!prerender_contents_.get()) |
| 761 return NULL; | 760 return NULL; |
| 762 return prerender_contents_->render_view_host(); | 761 return prerender_contents_->render_view_host(); |
| 763 } | 762 } |
| 764 return render_view_host_; | 763 return render_view_host_; |
| 765 } | 764 } |
| 766 | 765 |
| 767 } // namespace prerender | 766 } // namespace prerender |
| OLD | NEW |