Browse Source

src: mark virtual functions with override keyword

Add `override` keywords where appropriate.  Makes maintenance easier
because the compiler will shout at you when a base class changes in
an incompatible way.
archived-io.js-v0.12
Ben Noordhuis 10 years ago
parent
commit
9f5800ab81
  1. 46
      src/cares_wrap.cc
  2. 2
      src/fs_event_wrap.cc
  3. 2
      src/handle_wrap.h
  4. 6
      src/node.cc
  5. 2
      src/node_stat_watcher.h
  6. 2
      src/node_v8_platform.h
  7. 10
      src/smalloc.cc
  8. 14
      src/tls_wrap.h
  9. 2
      src/udp_wrap.h

46
src/cares_wrap.cc

@ -231,7 +231,7 @@ class QueryWrap : public AsyncWrap {
: AsyncWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_CARES) {
}
virtual ~QueryWrap() {
virtual ~QueryWrap() override {
CHECK_EQ(false, persistent().IsEmpty());
persistent().Reset();
}
@ -358,7 +358,7 @@ class QueryAWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -369,7 +369,7 @@ class QueryAWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -395,7 +395,7 @@ class QueryAaaaWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -406,7 +406,7 @@ class QueryAaaaWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -432,7 +432,7 @@ class QueryCnameWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -443,7 +443,7 @@ class QueryCnameWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct hostent* host;
@ -471,7 +471,7 @@ class QueryMxWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -482,7 +482,7 @@ class QueryMxWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -520,7 +520,7 @@ class QueryNsWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -531,7 +531,7 @@ class QueryNsWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct hostent* host;
@ -556,7 +556,7 @@ class QueryTxtWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -567,7 +567,7 @@ class QueryTxtWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct ares_txt_reply* txt_out;
@ -610,7 +610,7 @@ class QuerySrvWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -621,7 +621,7 @@ class QuerySrvWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -664,7 +664,7 @@ class QueryNaptrWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -675,7 +675,7 @@ class QueryNaptrWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -726,7 +726,7 @@ class QuerySoaWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
@ -737,7 +737,7 @@ class QuerySoaWrap: public QueryWrap {
}
protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@ -779,7 +779,7 @@ class GetHostByAddrWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name) {
int Send(const char* name) override {
int length, family;
char address_buffer[sizeof(struct in6_addr)];
@ -803,7 +803,7 @@ class GetHostByAddrWrap: public QueryWrap {
}
protected:
void Parse(struct hostent* host) {
void Parse(struct hostent* host) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
this->CallOnComplete(HostentToNames(env(), host));
@ -817,7 +817,7 @@ class GetHostByNameWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}
int Send(const char* name, int family) {
int Send(const char* name, int family) override {
ares_gethostbyname(env()->cares_channel(),
name,
family,
@ -827,7 +827,7 @@ class GetHostByNameWrap: public QueryWrap {
}
protected:
void Parse(struct hostent* host) {
void Parse(struct hostent* host) override {
HandleScope scope(env()->isolate());
Local<Array> addresses = HostentToAddresses(env(), host);

2
src/fs_event_wrap.cc

@ -54,7 +54,7 @@ class FSEventWrap: public HandleWrap {
private:
FSEventWrap(Environment* env, Handle<Object> object);
virtual ~FSEventWrap();
virtual ~FSEventWrap() override;
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
int status);

2
src/handle_wrap.h

@ -64,7 +64,7 @@ class HandleWrap : public AsyncWrap {
v8::Handle<v8::Object> object,
uv_handle_t* handle,
AsyncWrap::ProviderType provider);
virtual ~HandleWrap();
virtual ~HandleWrap() override;
private:
friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);

6
src/node.cc

@ -160,9 +160,9 @@ class ArrayBufferAllocator : public ArrayBuffer::Allocator {
static const size_t kMaxLength = 0x3fffffff;
static ArrayBufferAllocator the_singleton;
virtual ~ArrayBufferAllocator() {}
virtual void* Allocate(size_t length);
virtual void* AllocateUninitialized(size_t length);
virtual void Free(void* data, size_t length);
virtual void* Allocate(size_t length) override;
virtual void* AllocateUninitialized(size_t length) override;
virtual void Free(void* data, size_t length) override;
private:
ArrayBufferAllocator() {}
ArrayBufferAllocator(const ArrayBufferAllocator&);

2
src/node_stat_watcher.h

@ -32,7 +32,7 @@ namespace node {
class StatWatcher : public AsyncWrap {
public:
virtual ~StatWatcher();
virtual ~StatWatcher() override;
static void Initialize(Environment* env, v8::Handle<v8::Object> target);

2
src/node_v8_platform.h

@ -51,7 +51,7 @@ class TaskQueue {
class Platform : public v8::Platform {
public:
explicit Platform(unsigned int worker_count);
~Platform();
virtual ~Platform() override;
void CallOnBackgroundThread(v8::Task* task,
ExpectedRuntime expected_runtime);

10
src/smalloc.cc

@ -473,11 +473,11 @@ class RetainedAllocInfo: public RetainedObjectInfo {
public:
explicit RetainedAllocInfo(Handle<Value> wrapper);
virtual void Dispose();
virtual bool IsEquivalent(RetainedObjectInfo* other);
virtual intptr_t GetHash();
virtual const char* GetLabel();
virtual intptr_t GetSizeInBytes();
virtual void Dispose() override;
virtual bool IsEquivalent(RetainedObjectInfo* other) override;
virtual intptr_t GetHash() override;
virtual const char* GetLabel() override;
virtual intptr_t GetSizeInBytes() override;
private:
static const char label_[];

14
src/tls_wrap.h

@ -52,22 +52,22 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);
const char* Error();
int TryWrite(uv_buf_t** bufs, size_t* count);
const char* Error() override;
int TryWrite(uv_buf_t** bufs, size_t* count) override;
int DoWrite(WriteWrap* w,
uv_buf_t* bufs,
size_t count,
uv_stream_t* send_handle,
uv_write_cb cb);
void AfterWrite(WriteWrap* w);
uv_write_cb cb) override;
void AfterWrite(WriteWrap* w) override;
void DoAlloc(uv_handle_t* handle,
size_t suggested_size,
uv_buf_t* buf);
uv_buf_t* buf) override;
void DoRead(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf,
uv_handle_type pending);
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb);
uv_handle_type pending) override;
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb) override;
void NewSessionDoneCb();

2
src/udp_wrap.h

@ -58,7 +58,7 @@ class UDPWrap: public HandleWrap {
private:
UDPWrap(Environment* env, v8::Handle<v8::Object> object);
virtual ~UDPWrap();
virtual ~UDPWrap() override;
static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
int family);

Loading…
Cancel
Save