Bug 1048252 - Fix some bad implicit constructors in chromium IPC code; r=bent

This commit is contained in:
Ehsan Akhgari 2014-08-05 09:37:28 -04:00
Родитель 3a6aef3468
Коммит 13da4e4c33
9 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -458,7 +458,7 @@ public:
//
class MessageLoopForUI : public MessageLoop {
public:
MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) {
explicit MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) {
}
// Returns the MessageLoopForUI of the current thread.

Просмотреть файл

@ -77,7 +77,7 @@ class ObserverList {
};
ObserverList() : notify_depth_(0), type_(NOTIFY_ALL) {}
ObserverList(NotificationType type) : notify_depth_(0), type_(type) {}
explicit ObserverList(NotificationType type) : notify_depth_(0), type_(type) {}
~ObserverList() {
// When check_empty is true, assert that the list is empty on destruction.
if (check_empty) {
@ -118,7 +118,7 @@ class ObserverList {
// also the FOREACH_OBSERVER macro defined below.
class Iterator {
public:
Iterator(const ObserverList<ObserverType>& list)
explicit Iterator(const ObserverList<ObserverType>& list)
: list_(list),
index_(0),
max_index_(list.type_ == NOTIFY_ALL ?

Просмотреть файл

@ -120,7 +120,7 @@ template<typename T>
class RefCountedData : public base::RefCounted< base::RefCountedData<T> > {
public:
RefCountedData() : data() {}
RefCountedData(const T& in_value) : data(in_value) {}
explicit RefCountedData(const T& in_value) : data(in_value) {}
T data;
};
@ -181,7 +181,7 @@ class scoped_refptr {
scoped_refptr() : ptr_(NULL) {
}
scoped_refptr(T* p) : ptr_(p) {
MOZ_IMPLICIT scoped_refptr(T* p) : ptr_(p) {
if (ptr_)
ptr_->AddRef();
}

Просмотреть файл

@ -17,7 +17,7 @@ class RevocableStore {
// require the store.
class StoreRef : public base::RefCounted<StoreRef> {
public:
StoreRef(RevocableStore* store) : store_(store) { }
explicit StoreRef(RevocableStore* store) : store_(store) { }
void set_store(RevocableStore* store) { store_ = store; }
RevocableStore* store() const { return store_; }
@ -32,7 +32,7 @@ class RevocableStore {
// store.
class Revocable {
public:
Revocable(RevocableStore* store);
explicit Revocable(RevocableStore* store);
~Revocable();
// This item has been revoked if it no longer has a pointer to the store.

Просмотреть файл

@ -37,9 +37,9 @@ class StringPiece {
// in a "const char*" or a "string" wherever a "StringPiece" is
// expected.
StringPiece() : ptr_(NULL), length_(0) { }
StringPiece(const char* str)
MOZ_IMPLICIT StringPiece(const char* str)
: ptr_(str), length_((str == NULL) ? 0 : strlen(str)) { }
StringPiece(const std::string& str)
MOZ_IMPLICIT StringPiece(const std::string& str)
: ptr_(str.data()), length_(str.size()) { }
StringPiece(const char* offset, size_type len)
: ptr_(offset), length_(len) { }

Просмотреть файл

@ -142,7 +142,7 @@ struct DCheckAsserter : public AsserterBase {
class ThreadCollisionWarner {
public:
// The parameter asserter is there only for test purpose
ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
: valid_thread_id_(0),
counter_(0),
asserter_(asserter) {}

Просмотреть файл

@ -51,7 +51,7 @@ int64_t TimeDelta::InMicroseconds() const {
Time Time::FromTimeT(time_t tt) {
if (tt == 0)
return Time(); // Preserve 0 so we can tell it doesn't exist.
return (tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset;
return Time((tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset);
}
time_t Time::ToTimeT() const {
@ -62,8 +62,8 @@ time_t Time::ToTimeT() const {
// static
Time Time::FromDoubleT(double dt) {
return (dt * static_cast<double>(kMicrosecondsPerSecond)) +
kTimeTToMicrosecondsOffset;
return Time((dt * static_cast<double>(kMicrosecondsPerSecond)) +
kTimeTToMicrosecondsOffset);
}
double Time::ToDoubleT() const {

Просмотреть файл

@ -297,10 +297,10 @@ class Time {
// Return a new time modified by some delta.
Time operator+(TimeDelta delta) const {
return us_ + delta.delta_;
return Time(us_ + delta.delta_);
}
Time operator-(TimeDelta delta) const {
return us_ - delta.delta_;
return Time(us_ - delta.delta_);
}
// Comparison operators
@ -334,7 +334,7 @@ class Time {
// |is_local = true| or UTC |is_local = false|.
static Time FromExploded(bool is_local, const Exploded& exploded);
Time(int64_t us) : us_(us) {
explicit Time(int64_t us) : us_(us) {
}
// The representation of Jan 1, 1970 UTC in microseconds since the

Просмотреть файл

@ -85,7 +85,7 @@ class BaseTimer_Helper {
// We have access to the timer_ member so we can orphan this task.
class TimerTask : public Task {
public:
TimerTask(TimeDelta delay) : delay_(delay) {
explicit TimerTask(TimeDelta delay) : delay_(delay) {
// timer_ is set in InitiateDelayedTask.
}
virtual ~TimerTask() {}