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

Side by Side Diff: chrome/browser/printing/background_printing_manager.cc

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 years, 7 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 (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/printing/background_printing_manager.h" 5 #include "chrome/browser/printing/background_printing_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/printing/print_job.h" 9 #include "chrome/browser/printing/print_job.h"
10 #include "chrome/browser/printing/print_preview_dialog_controller.h" 10 #include "chrome/browser/printing/print_preview_dialog_controller.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace printing { 22 namespace printing {
23 23
24 class BackgroundPrintingManager::Observer 24 class BackgroundPrintingManager::Observer
25 : public content::WebContentsObserver { 25 : public content::WebContentsObserver {
26 public: 26 public:
27 Observer(BackgroundPrintingManager* manager, WebContents* web_contents); 27 Observer(BackgroundPrintingManager* manager, WebContents* web_contents);
28 28
29 private: 29 private:
30 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; 30 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
31 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; 31 virtual void WebContentsDestroyed() OVERRIDE;
32 32
33 BackgroundPrintingManager* manager_; 33 BackgroundPrintingManager* manager_;
34 }; 34 };
35 35
36 BackgroundPrintingManager::Observer::Observer( 36 BackgroundPrintingManager::Observer::Observer(
37 BackgroundPrintingManager* manager, WebContents* web_contents) 37 BackgroundPrintingManager* manager, WebContents* web_contents)
38 : content::WebContentsObserver(web_contents), 38 : content::WebContentsObserver(web_contents),
39 manager_(manager) { 39 manager_(manager) {
40 } 40 }
41 41
42 void BackgroundPrintingManager::Observer::RenderProcessGone( 42 void BackgroundPrintingManager::Observer::RenderProcessGone(
43 base::TerminationStatus status) { 43 base::TerminationStatus status) {
44 manager_->DeletePreviewContents(web_contents()); 44 manager_->DeletePreviewContents(web_contents());
45 } 45 }
46 void BackgroundPrintingManager::Observer::WebContentsDestroyed( 46 void BackgroundPrintingManager::Observer::WebContentsDestroyed() {
47 WebContents* web_contents) { 47 manager_->DeletePreviewContents(web_contents());
48 manager_->DeletePreviewContents(web_contents);
49 } 48 }
50 49
51 BackgroundPrintingManager::BackgroundPrintingManager() { 50 BackgroundPrintingManager::BackgroundPrintingManager() {
52 DCHECK_CURRENTLY_ON(BrowserThread::UI); 51 DCHECK_CURRENTLY_ON(BrowserThread::UI);
53 } 52 }
54 53
55 BackgroundPrintingManager::~BackgroundPrintingManager() { 54 BackgroundPrintingManager::~BackgroundPrintingManager() {
56 DCHECK(CalledOnValidThread()); 55 DCHECK(CalledOnValidThread());
57 // The might be some WebContentses still in |printing_contents_map_| at this 56 // The might be some WebContentses still in |printing_contents_map_| at this
58 // point (e.g. when the last remaining tab closes and there is still a print 57 // point (e.g. when the last remaining tab closes and there is still a print
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 125 }
127 return result; 126 return result;
128 } 127 }
129 128
130 bool BackgroundPrintingManager::HasPrintPreviewDialog( 129 bool BackgroundPrintingManager::HasPrintPreviewDialog(
131 WebContents* preview_dialog) { 130 WebContents* preview_dialog) {
132 return ContainsKey(printing_contents_map_, preview_dialog); 131 return ContainsKey(printing_contents_map_, preview_dialog);
133 } 132 }
134 133
135 } // namespace printing 134 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698