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/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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 // can be dead slow. On the other side, we don't want to die infinitely for a | 539 // can be dead slow. On the other side, we don't want to die infinitely for a |
540 // real network error. Give the printer 60 seconds to comply. | 540 // real network error. Give the printer 60 seconds to comply. |
541 // | 541 // |
542 // - If we're looping because of renderer page generation, the renderer could | 542 // - If we're looping because of renderer page generation, the renderer could |
543 // be CPU bound, the page overly complex/large or the system just | 543 // be CPU bound, the page overly complex/large or the system just |
544 // memory-bound. | 544 // memory-bound. |
545 static const int kPrinterSettingsTimeout = 60000; | 545 static const int kPrinterSettingsTimeout = 60000; |
546 base::OneShotTimer<MessageLoop> quit_timer; | 546 base::OneShotTimer<MessageLoop> quit_timer; |
547 quit_timer.Start(FROM_HERE, | 547 quit_timer.Start(FROM_HERE, |
548 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), | 548 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), |
549 MessageLoop::current(), &MessageLoop::Quit); | 549 MessageLoop::current(), &MessageLoop::Quit); |
jar (doing other things)
2012/02/11 03:24:38
(again, orthogonal to your CL):
This is a terribl
dhollowa
2012/02/13 17:44:26
(Also added by Darin.)
jar (doing other things)
2012/02/13 18:03:02
Darin,
Was this your code? (or you just updated
| |
550 | 550 |
551 inside_inner_message_loop_ = true; | 551 inside_inner_message_loop_ = true; |
552 | 552 |
553 // Need to enable recursive task. | 553 // Need to enable recursive task. |
554 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 554 { |
555 MessageLoop::current()->SetNestableTasksAllowed(true); | 555 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
556 MessageLoop::current()->Run(); | 556 MessageLoop::current()->Run(); |
557 // Restore task state. | 557 } |
558 MessageLoop::current()->SetNestableTasksAllowed(old_state); | |
559 | 558 |
560 bool success = true; | 559 bool success = true; |
561 if (inside_inner_message_loop_) { | 560 if (inside_inner_message_loop_) { |
562 // Ok we timed out. That's sad. | 561 // Ok we timed out. That's sad. |
563 inside_inner_message_loop_ = false; | 562 inside_inner_message_loop_ = false; |
564 success = false; | 563 success = false; |
565 } | 564 } |
566 | 565 |
567 return success; | 566 return success; |
568 } | 567 } |
(...skipping 29 matching lines...) Expand all Loading... | |
598 } | 597 } |
599 | 598 |
600 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { | 599 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { |
601 // Don't print / print preview interstitials. | 600 // Don't print / print preview interstitials. |
602 if (web_contents()->ShowingInterstitialPage()) | 601 if (web_contents()->ShowingInterstitialPage()) |
603 return false; | 602 return false; |
604 return Send(message); | 603 return Send(message); |
605 } | 604 } |
606 | 605 |
607 } // namespace printing | 606 } // namespace printing |
OLD | NEW |