Commit 3538d39d authored by gab's avatar gab Committed by Commit Bot

Replace deprecated base::NonThreadSafe in chrome/browser/printing in favor of SequenceChecker.

Note to crash team: This CL is a refactor and has no intended behavior change.

This change was scripted by https://crbug.com/676387#c8.

Note-worthy for the reviewer:
 * SequenceChecker enforces thread-safety but not thread-affinity!
   If the classes that were updated are thread-affine (use thread local
   storage or a third-party API that does) they should be migrated to
   ThreadChecker instead.
 * ~NonThreadSafe() used to implcitly check in its destructor
   ~Sequence/ThreadChecker() doesn't by design. To keep this CL a
   no-op, an explicit check was added to the destructor of migrated
   classes.
 * NonThreadSafe used to provide access to subclasses, as such
   the |sequence_checker_| member was made protected rather than
   private where necessary.

BUG=676387
This CL was uploaded by git cl split.

Review-Url: https://codereview.chromium.org/2908273002
Cr-Commit-Position: refs/heads/master@{#476413}
parent 6b89a30a
...@@ -56,7 +56,7 @@ BackgroundPrintingManager::BackgroundPrintingManager() { ...@@ -56,7 +56,7 @@ BackgroundPrintingManager::BackgroundPrintingManager() {
} }
BackgroundPrintingManager::~BackgroundPrintingManager() { BackgroundPrintingManager::~BackgroundPrintingManager() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// The might be some WebContentses still in |printing_contents_map_| at this // The might be some WebContentses still in |printing_contents_map_| at this
// point (e.g. when the last remaining tab closes and there is still a print // point (e.g. when the last remaining tab closes and there is still a print
// preview WebContents trying to print). In such a case it will fail to print, // preview WebContents trying to print). In such a case it will fail to print,
...@@ -66,7 +66,7 @@ BackgroundPrintingManager::~BackgroundPrintingManager() { ...@@ -66,7 +66,7 @@ BackgroundPrintingManager::~BackgroundPrintingManager() {
void BackgroundPrintingManager::OwnPrintPreviewDialog( void BackgroundPrintingManager::OwnPrintPreviewDialog(
WebContents* preview_dialog) { WebContents* preview_dialog) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(PrintPreviewDialogController::IsPrintPreviewDialog(preview_dialog)); DCHECK(PrintPreviewDialogController::IsPrintPreviewDialog(preview_dialog));
CHECK(!HasPrintPreviewDialog(preview_dialog)); CHECK(!HasPrintPreviewDialog(preview_dialog));
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/non_thread_safe.h" #include "base/sequence_checker.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
...@@ -26,8 +26,7 @@ namespace printing { ...@@ -26,8 +26,7 @@ namespace printing {
// The hidden WebContents are no longer part of any Browser / TabStripModel. // The hidden WebContents are no longer part of any Browser / TabStripModel.
// The WebContents started life as a ConstrainedWebDialog. // The WebContents started life as a ConstrainedWebDialog.
// They get deleted when the printing finishes. // They get deleted when the printing finishes.
class BackgroundPrintingManager : public base::NonThreadSafe, class BackgroundPrintingManager : public content::NotificationObserver {
public content::NotificationObserver {
public: public:
class Observer; class Observer;
...@@ -65,6 +64,8 @@ class BackgroundPrintingManager : public base::NonThreadSafe, ...@@ -65,6 +64,8 @@ class BackgroundPrintingManager : public base::NonThreadSafe,
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment