Update to Chromium revision 14bd12d6 (#333041)

- Remove CefNavigationEntry::GetFrameName() (see http://crbug.com/477150#c5).
- Devirtualize base::BindState (see http://crbug.com/486594).
- Move Tuple to the base namespace.
This commit is contained in:
Marshall Greenblatt
2015-06-05 18:06:48 -04:00
parent d820080479
commit 378a64b39a
77 changed files with 523 additions and 549 deletions

View File

@@ -57,7 +57,7 @@
namespace base {
namespace subtle {
namespace cef_subtle {
class RefCountedBase {
public:
@@ -141,7 +141,7 @@ class RefCountedThreadSafeBase {
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
};
} // namespace subtle
} // namespace cef_subtle
//
// A base class for reference counted classes. Otherwise, known as a cheap
@@ -158,16 +158,16 @@ class RefCountedThreadSafeBase {
// You should always make your destructor private, to avoid any code deleting
// the object accidently while there are references to it.
template <class T>
class RefCounted : public subtle::RefCountedBase {
class RefCounted : public cef_subtle::RefCountedBase {
public:
RefCounted() {}
void AddRef() const {
subtle::RefCountedBase::AddRef();
cef_subtle::RefCountedBase::AddRef();
}
void Release() const {
if (subtle::RefCountedBase::Release()) {
if (cef_subtle::RefCountedBase::Release()) {
delete static_cast<const T*>(this);
}
}
@@ -208,16 +208,16 @@ struct DefaultRefCountedThreadSafeTraits {
// friend class base::RefCountedThreadSafe<MyFoo>;
// ~MyFoo();
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase {
class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase {
public:
RefCountedThreadSafe() {}
void AddRef() const {
subtle::RefCountedThreadSafeBase::AddRef();
cef_subtle::RefCountedThreadSafeBase::AddRef();
}
void Release() const {
if (subtle::RefCountedThreadSafeBase::Release()) {
if (cef_subtle::RefCountedThreadSafeBase::Release()) {
Traits::Destruct(static_cast<const T*>(this));
}
}

View File

@@ -56,7 +56,7 @@
#define CEF_INCLUDE_BASE_CEF_TUPLE_H_
#pragma once
#if defined(BASE_TUPLE_H__)
#if defined(BASE_TUPLE_H_)
// The Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
@@ -65,6 +65,8 @@
// For legacy compatibility, we name the first 8 tuple elements "a", "b", ...
// TODO(cef): Remove this code when cef_runnable.h is deleted.
namespace base {
#define DEFINE_TUPLE_LEAF(N, x) \
template <typename T> \
struct TupleLeaf<N, T> { \
@@ -127,6 +129,8 @@ template <typename A,
typename H>
using Tuple8 = Tuple<A, B, C, D, E, F, G, H>;
} // namespace base
#elif defined(BUILDING_CEF_SHARED)
// When building CEF include the Chromium header directly.
#include "base/tuple.h"
@@ -137,6 +141,8 @@ using Tuple8 = Tuple<A, B, C, D, E, F, G, H>;
#include "include/base/cef_bind_helpers.h"
namespace base {
// Traits ----------------------------------------------------------------------
//
// A simple traits class for tuple arguments.
@@ -1394,6 +1400,8 @@ inline void DispatchToMethod(ObjT* obj, Method method,
&out->e);
}
} // namespace base
#endif // !BUILDING_CEF_SHARED
#endif // CEF_INCLUDE_BASE_CEF_TUPLE_H_

View File

@@ -2554,22 +2554,27 @@ template <typename Runnable, typename RunType, typename BoundArgsType>
struct BindState;
template <typename Runnable, typename RunType>
struct BindState<Runnable, RunType, void()> : public BindStateBase {
struct BindState<Runnable, RunType, void()> final : public BindStateBase {
typedef Runnable RunnableType;
typedef false_type IsWeakCall;
typedef Invoker<0, BindState, RunType> InvokerType;
typedef typename InvokerType::UnboundRunType UnboundRunType;
explicit BindState(const Runnable& runnable)
: runnable_(runnable) {
: BindStateBase(&Destroy),
runnable_(runnable) {
}
virtual ~BindState() { }
~BindState() { }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
};
template <typename Runnable, typename RunType, typename P1>
struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1)> final : public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<1, BindState, RunType> InvokerType;
@@ -2579,20 +2584,25 @@ struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
typedef UnwrapTraits<P1> Bound1UnwrapTraits;
BindState(const Runnable& runnable, const P1& p1)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1) {
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
};
template <typename Runnable, typename RunType, typename P1, typename P2>
struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2)> final : public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<2, BindState, RunType> InvokerType;
@@ -2603,15 +2613,20 @@ struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
typedef UnwrapTraits<P2> Bound2UnwrapTraits;
BindState(const Runnable& runnable, const P1& p1, const P2& p2)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2) {
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;
@@ -2619,7 +2634,8 @@ struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
template <typename Runnable, typename RunType, typename P1, typename P2,
typename P3>
struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2, P3)> final
: public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<3, BindState, RunType> InvokerType;
@@ -2631,16 +2647,21 @@ struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
typedef UnwrapTraits<P3> Bound3UnwrapTraits;
BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2),
p3_(p3) {
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;
@@ -2649,8 +2670,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
template <typename Runnable, typename RunType, typename P1, typename P2,
typename P3, typename P4>
struct BindState<Runnable, RunType, void(P1, P2, P3,
P4)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2, P3, P4)> final
: public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<4, BindState, RunType> InvokerType;
@@ -2664,7 +2685,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3,
BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
const P4& p4)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2),
p3_(p3),
@@ -2672,9 +2694,13 @@ struct BindState<Runnable, RunType, void(P1, P2, P3,
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;
@@ -2684,8 +2710,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3,
template <typename Runnable, typename RunType, typename P1, typename P2,
typename P3, typename P4, typename P5>
struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
P5)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5)> final
: public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<5, BindState, RunType> InvokerType;
@@ -2700,7 +2726,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
const P4& p4, const P5& p5)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2),
p3_(p3),
@@ -2709,9 +2736,13 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;
@@ -2722,8 +2753,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
template <typename Runnable, typename RunType, typename P1, typename P2,
typename P3, typename P4, typename P5, typename P6>
struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
P6)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6)> final
: public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<6, BindState, RunType> InvokerType;
@@ -2739,7 +2770,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
const P4& p4, const P5& p5, const P6& p6)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2),
p3_(p3),
@@ -2749,9 +2781,13 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;
@@ -2763,8 +2799,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
template <typename Runnable, typename RunType, typename P1, typename P2,
typename P3, typename P4, typename P5, typename P6, typename P7>
struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
P7)> : public BindStateBase {
struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6, P7)> final
: public BindStateBase {
typedef Runnable RunnableType;
typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
typedef Invoker<7, BindState, RunType> InvokerType;
@@ -2781,7 +2817,8 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
const P4& p4, const P5& p5, const P6& p6, const P7& p7)
: runnable_(runnable),
: BindStateBase(&Destroy),
runnable_(runnable),
p1_(p1),
p2_(p2),
p3_(p3),
@@ -2792,9 +2829,13 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
}
virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
P1>::Release(p1_); }
static void Destroy(BindStateBase* self) {
delete static_cast<BindState*>(self);
}
RunnableType runnable_;
P1 p1_;
P2 p2_;

View File

@@ -38,25 +38,43 @@
#include <stddef.h>
#include "include/base/cef_atomic_ref_count.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h"
#include "include/base/cef_scoped_ptr.h"
#include "include/base/cef_template_util.h"
template <typename T>
class ScopedVector;
namespace base {
namespace cef_internal {
class CallbackBase;
// BindStateBase is used to provide an opaque handle that the Callback
// class can use to represent a function object with bound arguments. It
// behaves as an existential type that is used by a corresponding
// DoInvoke function to perform the function execution. This allows
// us to shield the Callback class from the types of the bound argument via
// "type erasure."
class BindStateBase : public RefCountedThreadSafe<BindStateBase> {
// At the base level, the only task is to add reference counting data. Don't use
// RefCountedThreadSafe since it requires the destructor to be a virtual method.
// Creating a vtable for every BindState template instantiation results in a lot
// of bloat. Its only task is to call the destructor which can be done with a
// function pointer.
class BindStateBase {
protected:
friend class RefCountedThreadSafe<BindStateBase>;
virtual ~BindStateBase() {}
explicit BindStateBase(void (*destructor)(BindStateBase*))
: ref_count_(0), destructor_(destructor) {}
~BindStateBase() = default;
private:
friend class scoped_refptr<BindStateBase>;
friend class CallbackBase;
void AddRef();
void Release();
AtomicRefCount ref_count_;
// Pointer to a function that will properly destroy |this|.
void (*destructor_)(BindStateBase*);
DISALLOW_COPY_AND_ASSIGN(BindStateBase);
};
// Holds the Callback methods that don't require specialization to reduce