Commit 088233a2 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Move a template specialization for a member pointer after the declaration of the base class.

This allows compilers targeting the MS ABI to select the correct
inheritance model for the member function pointer type RunnerMethodType
using the complete type of TaskHandle::Runner. It will allow us to
enable the new Clang flag -fcomplete-member-pointers globally.

Bug: 847724
Change-Id: Ib716e3c0774b7d6b46087e46057ca249e9aa72e7
Reviewed-on: https://chromium-review.googlesource.com/1079852Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563078}
parent 50ff9ebe
......@@ -7,26 +7,6 @@
#include "base/bind_helpers.h"
#include "base/single_thread_task_runner.h"
namespace base {
using RunnerMethodType =
void (blink::TaskHandle::Runner::*)(const blink::TaskHandle&);
template <>
struct CallbackCancellationTraits<
RunnerMethodType,
std::tuple<base::WeakPtr<blink::TaskHandle::Runner>, blink::TaskHandle>> {
static constexpr bool is_cancellable = true;
static bool IsCancelled(RunnerMethodType,
const base::WeakPtr<blink::TaskHandle::Runner>&,
const blink::TaskHandle& handle) {
return !handle.IsActive();
}
};
} // namespace base
namespace blink {
namespace {
......@@ -82,6 +62,30 @@ class TaskHandle::Runner : public WTF::ThreadSafeRefCounted<Runner> {
DISALLOW_COPY_AND_ASSIGN(Runner);
};
} // namespace blink
namespace base {
using RunnerMethodType =
void (blink::TaskHandle::Runner::*)(const blink::TaskHandle&);
template <>
struct CallbackCancellationTraits<
RunnerMethodType,
std::tuple<base::WeakPtr<blink::TaskHandle::Runner>, blink::TaskHandle>> {
static constexpr bool is_cancellable = true;
static bool IsCancelled(RunnerMethodType,
const base::WeakPtr<blink::TaskHandle::Runner>&,
const blink::TaskHandle& handle) {
return !handle.IsActive();
}
};
} // namespace base
namespace blink {
bool TaskHandle::IsActive() const {
return runner_ && runner_->IsActive();
}
......
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