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

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

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename back to "allow". Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/print_view_manager.h" 5 #include "chrome/browser/printing/print_view_manager.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // memory-bound. 549 // memory-bound.
550 static const int kPrinterSettingsTimeout = 60000; 550 static const int kPrinterSettingsTimeout = 60000;
551 base::OneShotTimer<MessageLoop> quit_timer; 551 base::OneShotTimer<MessageLoop> quit_timer;
552 quit_timer.Start(FROM_HERE, 552 quit_timer.Start(FROM_HERE,
553 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), 553 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout),
554 MessageLoop::current(), &MessageLoop::Quit); 554 MessageLoop::current(), &MessageLoop::Quit);
555 555
556 inside_inner_message_loop_ = true; 556 inside_inner_message_loop_ = true;
557 557
558 // Need to enable recursive task. 558 // Need to enable recursive task.
559 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 559 {
560 MessageLoop::current()->SetNestableTasksAllowed(true); 560 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
561 MessageLoop::current()->Run(); 561 MessageLoop::current()->Run();
562 // Restore task state. 562 }
563 MessageLoop::current()->SetNestableTasksAllowed(old_state);
564 563
565 bool success = true; 564 bool success = true;
566 if (inside_inner_message_loop_) { 565 if (inside_inner_message_loop_) {
567 // Ok we timed out. That's sad. 566 // Ok we timed out. That's sad.
568 inside_inner_message_loop_ = false; 567 inside_inner_message_loop_ = false;
569 success = false; 568 success = false;
570 } 569 }
571 570
572 return success; 571 return success;
573 } 572 }
(...skipping 29 matching lines...) Expand all
603 } 602 }
604 603
605 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { 604 bool PrintViewManager::PrintNowInternal(IPC::Message* message) {
606 // Don't print / print preview interstitials. 605 // Don't print / print preview interstitials.
607 if (web_contents()->ShowingInterstitialPage()) 606 if (web_contents()->ShowingInterstitialPage())
608 return false; 607 return false;
609 return Send(message); 608 return Send(message);
610 } 609 }
611 610
612 } // namespace printing 611 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698