| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_base.h" | 5 #include "chrome/browser/printing/print_view_manager_base.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 // - If we're looping because of printer settings initialization, the premise | 443 // - If we're looping because of printer settings initialization, the premise |
| 444 // here is that some poor users have their print server away on a VPN over a | 444 // here is that some poor users have their print server away on a VPN over a |
| 445 // slow connection. In this situation, the simple fact of opening the printer | 445 // slow connection. In this situation, the simple fact of opening the printer |
| 446 // can be dead slow. On the other side, we don't want to die infinitely for a | 446 // can be dead slow. On the other side, we don't want to die infinitely for a |
| 447 // real network error. Give the printer 60 seconds to comply. | 447 // real network error. Give the printer 60 seconds to comply. |
| 448 // | 448 // |
| 449 // - If we're looping because of renderer page generation, the renderer could | 449 // - If we're looping because of renderer page generation, the renderer could |
| 450 // be CPU bound, the page overly complex/large or the system just | 450 // be CPU bound, the page overly complex/large or the system just |
| 451 // memory-bound. | 451 // memory-bound. |
| 452 static const int kPrinterSettingsTimeout = 60000; | 452 static const int kPrinterSettingsTimeout = 60000; |
| 453 base::OneShotTimer<base::MessageLoop> quit_timer; | 453 base::OneShotTimer quit_timer; |
| 454 quit_timer.Start(FROM_HERE, | 454 quit_timer.Start(FROM_HERE, |
| 455 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), | 455 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), |
| 456 base::MessageLoop::current(), &base::MessageLoop::Quit); | 456 base::MessageLoop::current(), &base::MessageLoop::Quit); |
| 457 | 457 |
| 458 inside_inner_message_loop_ = true; | 458 inside_inner_message_loop_ = true; |
| 459 | 459 |
| 460 // Need to enable recursive task. | 460 // Need to enable recursive task. |
| 461 { | 461 { |
| 462 base::MessageLoop::ScopedNestableTaskAllower allow( | 462 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 463 base::MessageLoop::current()); | 463 base::MessageLoop::current()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 scoped_refptr<printing::PrinterQuery> printer_query; | 528 scoped_refptr<printing::PrinterQuery> printer_query; |
| 529 printer_query = queue_->PopPrinterQuery(cookie); | 529 printer_query = queue_->PopPrinterQuery(cookie); |
| 530 if (!printer_query.get()) | 530 if (!printer_query.get()) |
| 531 return; | 531 return; |
| 532 BrowserThread::PostTask( | 532 BrowserThread::PostTask( |
| 533 BrowserThread::IO, FROM_HERE, | 533 BrowserThread::IO, FROM_HERE, |
| 534 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 534 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace printing | 537 } // namespace printing |
| OLD | NEW |