| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // - If we're looping because of printer settings initialization, the premise | 429 // - If we're looping because of printer settings initialization, the premise |
| 430 // here is that some poor users have their print server away on a VPN over a | 430 // here is that some poor users have their print server away on a VPN over a |
| 431 // slow connection. In this situation, the simple fact of opening the printer | 431 // slow connection. In this situation, the simple fact of opening the printer |
| 432 // can be dead slow. On the other side, we don't want to die infinitely for a | 432 // can be dead slow. On the other side, we don't want to die infinitely for a |
| 433 // real network error. Give the printer 60 seconds to comply. | 433 // real network error. Give the printer 60 seconds to comply. |
| 434 // | 434 // |
| 435 // - If we're looping because of renderer page generation, the renderer could | 435 // - If we're looping because of renderer page generation, the renderer could |
| 436 // be CPU bound, the page overly complex/large or the system just | 436 // be CPU bound, the page overly complex/large or the system just |
| 437 // memory-bound. | 437 // memory-bound. |
| 438 static const int kPrinterSettingsTimeout = 60000; | 438 static const int kPrinterSettingsTimeout = 60000; |
| 439 base::OneShotTimer<base::MessageLoop> quit_timer; | 439 base::OneShotTimer quit_timer; |
| 440 quit_timer.Start(FROM_HERE, | 440 quit_timer.Start(FROM_HERE, |
| 441 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), | 441 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), |
| 442 base::MessageLoop::current(), &base::MessageLoop::Quit); | 442 base::MessageLoop::current(), &base::MessageLoop::Quit); |
| 443 | 443 |
| 444 inside_inner_message_loop_ = true; | 444 inside_inner_message_loop_ = true; |
| 445 | 445 |
| 446 // Need to enable recursive task. | 446 // Need to enable recursive task. |
| 447 { | 447 { |
| 448 base::MessageLoop::ScopedNestableTaskAllower allow( | 448 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 449 base::MessageLoop::current()); | 449 base::MessageLoop::current()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 scoped_refptr<printing::PrinterQuery> printer_query; | 514 scoped_refptr<printing::PrinterQuery> printer_query; |
| 515 printer_query = queue_->PopPrinterQuery(cookie); | 515 printer_query = queue_->PopPrinterQuery(cookie); |
| 516 if (!printer_query.get()) | 516 if (!printer_query.get()) |
| 517 return; | 517 return; |
| 518 BrowserThread::PostTask( | 518 BrowserThread::PostTask( |
| 519 BrowserThread::IO, FROM_HERE, | 519 BrowserThread::IO, FROM_HERE, |
| 520 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); | 520 base::Bind(&PrinterQuery::StopWorker, printer_query.get())); |
| 521 } | 521 } |
| 522 | 522 |
| 523 } // namespace printing | 523 } // namespace printing |
| OLD | NEW |