Skip to content

Commit

Permalink
Bug 1060997 - Fix more bad implicit constructors in IPC; r=smaug
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan committed Sep 1, 2014
1 parent 4d691ed commit 05c4647
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/debug_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace mozilla {
class EnvironmentLog
{
public:
EnvironmentLog(const char* varname);
explicit EnvironmentLog(const char* varname);
~EnvironmentLog();

void print(const char* format, ...);
Expand Down
16 changes: 8 additions & 8 deletions ipc/chromium/src/base/stl_util-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -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_;
Expand All @@ -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_);
}
Expand All @@ -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) {
}
};
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/thread_local_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/chrome/common/child_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions ipc/chromium/src/chrome/common/child_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/chrome/common/child_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions ipc/chromium/src/chrome/common/mach_ipc_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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();
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions ipc/chromium/src/chrome/common/notification_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class NotificationDetails {
}

protected:
NotificationDetails(void* ptr) : ptr_(ptr) {}
explicit NotificationDetails(void* ptr) : ptr_(ptr) {}

void* ptr_;
};

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(); }
Expand Down
6 changes: 3 additions & 3 deletions ipc/chromium/src/chrome/common/notification_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ class NotificationSource {
}

protected:
NotificationSource(void* ptr) : ptr_(ptr) {}
explicit NotificationSource(void* ptr) : ptr_(ptr) {}

void* ptr_;
};

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(); }
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/chrome/common/notification_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/BackgroundChildImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions ipc/glue/BackgroundImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class ChildImpl MOZ_FINAL : public BackgroundChildImpl

struct ThreadLocalInfo
{
ThreadLocalInfo(nsIIPCBackgroundChildCreateCallback* aCallback)
explicit ThreadLocalInfo(nsIIPCBackgroundChildCreateCallback* aCallback)
{
mCallbacks.AppendElement(aCallback);
}
Expand Down Expand Up @@ -498,7 +498,7 @@ class ParentImpl::RequestMessageLoopRunnable MOZ_FINAL :
MessageLoop* mMessageLoop;

public:
RequestMessageLoopRunnable(nsIThread* aTargetThread)
explicit RequestMessageLoopRunnable(nsIThread* aTargetThread)
: mTargetThread(aTargetThread), mMessageLoop(nullptr)
{
AssertIsInMainProcess();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -674,7 +674,7 @@ class ChildImpl::ParentCreateCallback MOZ_FINAL :
nsCOMPtr<nsIEventTarget> mEventTarget;

public:
ParentCreateCallback(nsIEventTarget* aEventTarget)
explicit ParentCreateCallback(nsIEventTarget* aEventTarget)
: mEventTarget(aEventTarget)
{
AssertIsInMainProcess();
Expand Down
4 changes: 2 additions & 2 deletions ipc/glue/GeckoChildProcessHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ GeckoChildProcessHost::GetPathToBinary(FilePath& exePath)
#ifdef MOZ_WIDGET_COCOA
class AutoCFTypeObject {
public:
AutoCFTypeObject(CFTypeRef object)
explicit AutoCFTypeObject(CFTypeRef object)
{
mObject = object;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ipc/glue/MessageChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/MessagePump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/ProcessChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ProcessChild : public ChildProcess {
typedef base::ProcessHandle ProcessHandle;

public:
ProcessChild(ProcessHandle parentHandle);
explicit ProcessChild(ProcessHandle parentHandle);
virtual ~ProcessChild();

virtual bool Init() = 0;
Expand Down
4 changes: 2 additions & 2 deletions toolkit/xre/nsEmbedFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 05c4647

Please sign in to comment.