Bug 1060997 - Fix more bad implicit constructors in IPC; r=smaug

This commit is contained in:
Ehsan Akhgari 2014-08-31 21:12:55 -04:00
Родитель ddca1158ca
Коммит 8e138d4419
17 изменённых файлов: 41 добавлений и 41 удалений

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

@ -72,7 +72,7 @@ namespace mozilla {
class EnvironmentLog
{
public:
EnvironmentLog(const char* varname);
explicit EnvironmentLog(const char* varname);
~EnvironmentLog();
void print(const char* format, ...);

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

@ -267,7 +267,7 @@ void STLDeleteValues(T *v) {
template<class STLContainer> class STLElementDeleter {
public:
STLElementDeleter(STLContainer *ptr) : container_ptr_(ptr) {}
explicit STLElementDeleter(STLContainer *ptr) : container_ptr_(ptr) {}
~STLElementDeleter() { STLDeleteElements(container_ptr_); }
private:
STLContainer *container_ptr_;
@ -278,7 +278,7 @@ template<class STLContainer> class STLElementDeleter {
template<class STLContainer> class STLValueDeleter {
public:
STLValueDeleter(STLContainer *ptr) : container_ptr_(ptr) {}
explicit STLValueDeleter(STLContainer *ptr) : container_ptr_(ptr) {}
~STLValueDeleter() { STLDeleteValues(container_ptr_); }
private:
STLContainer *container_ptr_;
@ -301,7 +301,7 @@ class STLBinaryFunction : public std::binary_function<Arg1, Arg2, Result> {
public:
typedef ResultCallback2<Result, Arg1, Arg2> Callback;
STLBinaryFunction(Callback* callback)
explicit STLBinaryFunction(Callback* callback)
: callback_(callback) {
assert(callback_);
}
@ -325,7 +325,7 @@ template <class Arg>
class STLBinaryPredicate : public STLBinaryFunction<bool, Arg, Arg> {
public:
typedef typename STLBinaryPredicate<Arg>::Callback Callback;
STLBinaryPredicate(Callback* callback)
explicit STLBinaryPredicate(Callback* callback)
: STLBinaryFunction<bool, Arg, Arg>(callback) {
}
};
@ -351,7 +351,7 @@ class UnaryOperateOnFirst
UnaryOperateOnFirst() {
}
UnaryOperateOnFirst(const UnaryOp& f) : f_(f) {
explicit UnaryOperateOnFirst(const UnaryOp& f) : f_(f) {
}
typename UnaryOp::result_type operator()(const Pair& p) const {
@ -374,7 +374,7 @@ class UnaryOperateOnSecond
UnaryOperateOnSecond() {
}
UnaryOperateOnSecond(const UnaryOp& f) : f_(f) {
explicit UnaryOperateOnSecond(const UnaryOp& f) : f_(f) {
}
typename UnaryOp::result_type operator()(const Pair& p) const {
@ -397,7 +397,7 @@ class BinaryOperateOnFirst
BinaryOperateOnFirst() {
}
BinaryOperateOnFirst(const BinaryOp& f) : f_(f) {
explicit BinaryOperateOnFirst(const BinaryOp& f) : f_(f) {
}
typename BinaryOp::result_type operator()(const Pair& p1,
@ -421,7 +421,7 @@ class BinaryOperateOnSecond
BinaryOperateOnSecond() {
}
BinaryOperateOnSecond(const BinaryOp& f) : f_(f) {
explicit BinaryOperateOnSecond(const BinaryOp& f) : f_(f) {
}
typename BinaryOp::result_type operator()(const Pair& p1,

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

@ -24,7 +24,7 @@ class ThreadLocalStorage {
// A key representing one value stored in TLS.
class Slot {
public:
Slot(TLSDestructorFunc destructor = NULL);
explicit Slot(TLSDestructorFunc destructor = NULL);
// This constructor should be used for statics.
// It returns an uninitialized Slot.

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

@ -21,7 +21,7 @@ class ChildProcess {
public:
// Child processes should have an object that derives from this class. The
// constructor will return once ChildThread has started.
ChildProcess(ChildThread* child_thread);
explicit ChildProcess(ChildThread* child_thread);
virtual ~ChildProcess();
// Getter for this process' main thread.

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

@ -113,7 +113,7 @@ void ChildProcessHost::SetHandle(base::ProcessHandle process) {
}
void ChildProcessHost::InstanceCreated() {
Notify(NotificationType::CHILD_INSTANCE_CREATED);
Notify(NotificationType(NotificationType::CHILD_INSTANCE_CREATED));
}
bool ChildProcessHost::Send(IPC::Message* msg) {
@ -188,7 +188,7 @@ void ChildProcessHost::ListenerHook::OnChannelConnected(int32_t peer_pid) {
host_->OnChannelConnected(peer_pid);
// Notify in the main loop of the connection.
host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED);
host_->Notify(NotificationType(NotificationType::CHILD_PROCESS_HOST_CONNECTED));
}
void ChildProcessHost::ListenerHook::OnChannelError() {

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

@ -17,7 +17,7 @@ class ChildThread : public IPC::Channel::Listener,
public base::Thread {
public:
// Creates the thread.
ChildThread(Thread::Options options);
explicit ChildThread(Thread::Options options);
virtual ~ChildThread();
// IPC::Message::Sender implementation:

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

@ -86,7 +86,7 @@ class MachMsgPortDescriptor : public mach_msg_port_descriptor_t {
}
// For passing send rights to a port
MachMsgPortDescriptor(mach_port_t in_name) {
explicit MachMsgPortDescriptor(mach_port_t in_name) {
name = in_name;
pad1 = 0;
pad2 = 0;
@ -251,7 +251,7 @@ class MachReceiveMessage : public MachMessage {
//==============================================================================
class MachSendMessage : public MachMessage {
public:
MachSendMessage(int32_t message_id);
explicit MachSendMessage(int32_t message_id);
MachSendMessage(void *storage, size_t storage_length, int32_t message_id);
private:
@ -265,11 +265,11 @@ class MachSendMessage : public MachMessage {
class ReceivePort {
public:
// Creates a new mach port for receiving messages and registers a name for it
ReceivePort(const char *receive_port_name);
explicit ReceivePort(const char *receive_port_name);
// Given an already existing mach port, use it. We take ownership of the
// port and deallocate it in our destructor.
ReceivePort(mach_port_t receive_port);
explicit ReceivePort(mach_port_t receive_port);
// Create a new mach port for receiving messages
ReceivePort();
@ -295,11 +295,11 @@ class ReceivePort {
class MachPortSender {
public:
// get a port with send rights corresponding to a named registered service
MachPortSender(const char *receive_port_name);
explicit MachPortSender(const char *receive_port_name);
// Given an already existing mach port, use it.
MachPortSender(mach_port_t send_port);
explicit MachPortSender(mach_port_t send_port);
kern_return_t SendMessage(MachSendMessage &message,
mach_msg_timeout_t timeout);

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

@ -33,7 +33,7 @@ class NotificationDetails {
}
protected:
NotificationDetails(void* ptr) : ptr_(ptr) {}
explicit NotificationDetails(void* ptr) : ptr_(ptr) {}
void* ptr_;
};
@ -41,8 +41,8 @@ class NotificationDetails {
template <class T>
class Details : public NotificationDetails {
public:
Details(T* ptr) : NotificationDetails(ptr) {}
Details(const NotificationDetails& other)
explicit Details(T* ptr) : NotificationDetails(ptr) {}
explicit Details(const NotificationDetails& other)
: NotificationDetails(other) {}
T* operator->() const { return ptr(); }

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

@ -31,7 +31,7 @@ class NotificationSource {
}
protected:
NotificationSource(void* ptr) : ptr_(ptr) {}
explicit NotificationSource(void* ptr) : ptr_(ptr) {}
void* ptr_;
};
@ -39,9 +39,9 @@ class NotificationSource {
template <class T>
class Source : public NotificationSource {
public:
Source(T* ptr) : NotificationSource(ptr) {}
explicit Source(T* ptr) : NotificationSource(ptr) {}
Source(const NotificationSource& other)
explicit Source(const NotificationSource& other)
: NotificationSource(other) {}
T* operator->() const { return ptr(); }

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

@ -552,7 +552,7 @@ class NotificationType {
NOTIFICATION_TYPE_COUNT
};
NotificationType(Type v) : value(v) {}
explicit NotificationType(Type v) : value(v) {}
bool operator==(NotificationType t) const { return value == t.value; }
bool operator!=(NotificationType t) const { return value != t.value; }

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

@ -15,7 +15,7 @@ class TestChild MOZ_FINAL : public mozilla::ipc::PBackgroundTestChild
nsCString mTestArg;
TestChild(const nsCString& aTestArg)
explicit TestChild(const nsCString& aTestArg)
: mTestArg(aTestArg)
{
MOZ_COUNT_CTOR(TestChild);

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

@ -327,7 +327,7 @@ class ChildImpl MOZ_FINAL : public BackgroundChildImpl
struct ThreadLocalInfo
{
ThreadLocalInfo(nsIIPCBackgroundChildCreateCallback* aCallback)
explicit ThreadLocalInfo(nsIIPCBackgroundChildCreateCallback* aCallback)
{
mCallbacks.AppendElement(aCallback);
}
@ -498,7 +498,7 @@ class ParentImpl::RequestMessageLoopRunnable MOZ_FINAL :
MessageLoop* mMessageLoop;
public:
RequestMessageLoopRunnable(nsIThread* aTargetThread)
explicit RequestMessageLoopRunnable(nsIThread* aTargetThread)
: mTargetThread(aTargetThread), mMessageLoop(nullptr)
{
AssertIsInMainProcess();
@ -538,7 +538,7 @@ class ParentImpl::ForceCloseBackgroundActorsRunnable MOZ_FINAL : public nsRunnab
nsTArray<ParentImpl*>* mActorArray;
public:
ForceCloseBackgroundActorsRunnable(nsTArray<ParentImpl*>* aActorArray)
explicit ForceCloseBackgroundActorsRunnable(nsTArray<ParentImpl*>* aActorArray)
: mActorArray(aActorArray)
{
AssertIsInMainProcess();
@ -560,7 +560,7 @@ class ParentImpl::CreateCallbackRunnable MOZ_FINAL : public nsRunnable
nsRefPtr<CreateCallback> mCallback;
public:
CreateCallbackRunnable(CreateCallback* aCallback)
explicit CreateCallbackRunnable(CreateCallback* aCallback)
: mCallback(aCallback)
{
AssertIsInMainProcess();
@ -674,7 +674,7 @@ class ChildImpl::ParentCreateCallback MOZ_FINAL :
nsCOMPtr<nsIEventTarget> mEventTarget;
public:
ParentCreateCallback(nsIEventTarget* aEventTarget)
explicit ParentCreateCallback(nsIEventTarget* aEventTarget)
: mEventTarget(aEventTarget)
{
AssertIsInMainProcess();

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

@ -154,7 +154,7 @@ GeckoChildProcessHost::GetPathToBinary(FilePath& exePath)
#ifdef MOZ_WIDGET_COCOA
class AutoCFTypeObject {
public:
AutoCFTypeObject(CFTypeRef object)
explicit AutoCFTypeObject(CFTypeRef object)
{
mObject = object;
}
@ -712,7 +712,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
MachPortSender parent_sender(child_message.GetTranslatedPort(1));
MachSendMessage parent_message(/* id= */0);
if (!parent_message.AddDescriptor(bootstrap_port)) {
if (!parent_message.AddDescriptor(MachMsgPortDescriptor(bootstrap_port))) {
CHROMIUM_LOG(ERROR) << "parent AddDescriptor(" << bootstrap_port << ") failed.";
return false;
}

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

@ -195,8 +195,8 @@ namespace {
class MOZ_STACK_CLASS MaybeScriptBlocker {
public:
MaybeScriptBlocker(MessageChannel *aChannel
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit MaybeScriptBlocker(MessageChannel *aChannel
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mBlocked(aChannel->ShouldBlockScripts())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;

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

@ -45,7 +45,7 @@ class DoWorkRunnable MOZ_FINAL : public nsICancelableRunnable,
public nsITimerCallback
{
public:
DoWorkRunnable(MessagePump* aPump)
explicit DoWorkRunnable(MessagePump* aPump)
: mPump(aPump)
{
MOZ_ASSERT(aPump);

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

@ -25,7 +25,7 @@ protected:
typedef base::ProcessHandle ProcessHandle;
public:
ProcessChild(ProcessHandle parentHandle);
explicit ProcessChild(ProcessHandle parentHandle);
virtual ~ProcessChild();
virtual bool Init() = 0;

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

@ -329,14 +329,14 @@ XRE_InitChildProcess(int aArgc,
const int kTimeoutMs = 1000;
MachSendMessage child_message(0);
if (!child_message.AddDescriptor(mach_task_self())) {
if (!child_message.AddDescriptor(MachMsgPortDescriptor(mach_task_self()))) {
NS_WARNING("child AddDescriptor(mach_task_self()) failed.");
return NS_ERROR_FAILURE;
}
ReceivePort child_recv_port;
mach_port_t raw_child_recv_port = child_recv_port.GetPort();
if (!child_message.AddDescriptor(raw_child_recv_port)) {
if (!child_message.AddDescriptor(MachMsgPortDescriptor(raw_child_recv_port))) {
NS_WARNING("Adding descriptor to message failed");
return NS_ERROR_FAILURE;
}