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

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

Issue 12741012: base: Support setting thread priorities generically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static initializers. Created 7 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/print_job.h" 5 #include "chrome/browser/printing/print_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // manner by the mere fact that the thread will terminate. So the potential 324 // manner by the mere fact that the thread will terminate. So the potential
325 // deadlock is eliminated. 325 // deadlock is eliminated.
326 worker_->StopSoon(); 326 worker_->StopSoon();
327 327
328 // Run a tight message loop until the worker terminates. It may seems like a 328 // Run a tight message loop until the worker terminates. It may seems like a
329 // hack but I see no other way to get it to work flawlessly. The issues here 329 // hack but I see no other way to get it to work flawlessly. The issues here
330 // are: 330 // are:
331 // - We don't want to run tasks while the thread is quitting. 331 // - We don't want to run tasks while the thread is quitting.
332 // - We want this code path to wait on the thread to quit before continuing. 332 // - We want this code path to wait on the thread to quit before continuing.
333 MSG msg; 333 MSG msg;
334 HANDLE thread_handle = worker_->thread_handle(); 334 HANDLE thread_handle = worker_->thread_handle().platform_handle();
335 for (; thread_handle;) { 335 for (; thread_handle;) {
336 // Note that we don't do any kind of message prioritization since we don't 336 // Note that we don't do any kind of message prioritization since we don't
337 // execute any pending task or timer. 337 // execute any pending task or timer.
338 DWORD result = MsgWaitForMultipleObjects(1, &thread_handle, 338 DWORD result = MsgWaitForMultipleObjects(1, &thread_handle,
339 FALSE, INFINITE, QS_ALLINPUT); 339 FALSE, INFINITE, QS_ALLINPUT);
340 if (result == WAIT_OBJECT_0 + 1) { 340 if (result == WAIT_OBJECT_0 + 1) {
341 while (PeekMessage(&msg, NULL, 0, 0, TRUE) > 0) { 341 while (PeekMessage(&msg, NULL, 0, 0, TRUE) > 0) {
342 TranslateMessage(&msg); 342 TranslateMessage(&msg);
343 DispatchMessage(&msg); 343 DispatchMessage(&msg);
344 } 344 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 PrintedDocument* JobEventDetails::document() const { 393 PrintedDocument* JobEventDetails::document() const {
394 return document_; 394 return document_;
395 } 395 }
396 396
397 PrintedPage* JobEventDetails::page() const { 397 PrintedPage* JobEventDetails::page() const {
398 return page_; 398 return page_;
399 } 399 }
400 400
401 } // namespace printing 401 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/content_settings_pref_provider_unittest.cc ('k') | chrome_frame/chrome_frame_automation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698