Commit 79ba0231 authored by gab's avatar gab Committed by Commit Bot

Replace deprecated base::NonThreadSafe in chrome/browser/safe_browsing 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.

R=nparker@chromium.org

Review-Url: https://codereview.chromium.org/2909123003
Cr-Commit-Position: refs/heads/master@{#476399}
parent 1283be78
......@@ -163,6 +163,7 @@ DelayableCertReportURLRequestJob::DelayableCertReportURLRequestJob(
weak_factory_(this) {}
DelayableCertReportURLRequestJob::~DelayableCertReportURLRequestJob() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
destruction_callback_);
}
......
......@@ -9,7 +9,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/threading/non_thread_safe.h"
#include "base/sequence_checker.h"
#include "chrome/browser/safe_browsing/certificate_reporting_service.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
......@@ -100,8 +100,7 @@ class RequestObserver {
// empty response. If Resume() is called before a request is made, then the
// request will not be delayed. If not delayed, it can return a failed or a
// successful URL request job.
class DelayableCertReportURLRequestJob : public net::URLRequestJob,
public base::NonThreadSafe {
class DelayableCertReportURLRequestJob : public net::URLRequestJob {
public:
DelayableCertReportURLRequestJob(
bool delayed,
......@@ -128,6 +127,9 @@ class DelayableCertReportURLRequestJob : public net::URLRequestJob,
bool should_fail_;
bool started_;
base::Callback<void()> destruction_callback_;
SEQUENCE_CHECKER(sequence_checker_);
base::WeakPtrFactory<DelayableCertReportURLRequestJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(DelayableCertReportURLRequestJob);
......
......@@ -11,7 +11,6 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/safe_browsing/two_phase_uploader.h"
namespace safe_browsing {
......@@ -20,7 +19,7 @@ class DownloadFeedbackFactory;
// Handles the uploading of a single downloaded binary to the safebrowsing
// download feedback service.
class DownloadFeedback : public base::NonThreadSafe {
class DownloadFeedback {
public:
// Takes ownership of the file pointed to be |file_path|, it will be deleted
// when the DownloadFeedback is destructed.
......
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