diff options
author | dcheng <dcheng@chromium.org> | 2014-10-23 12:08:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-23 19:09:19 +0000 |
commit | 074c039593e8beb054fcc7a2701e753883eaa596 (patch) | |
tree | 88c830fd932ec658bc7e98a8e995068c418802d9 /gin | |
parent | 7eeb2fab96ab2a51e0d9f9a81c6ff4ab5b1aa8c8 (diff) | |
download | chromium_src-074c039593e8beb054fcc7a2701e753883eaa596.zip chromium_src-074c039593e8beb054fcc7a2701e753883eaa596.tar.gz chromium_src-074c039593e8beb054fcc7a2701e753883eaa596.tar.bz2 |
Standardize usage of virtual/override/final in gin/
The Google C++ style guide states:
Explicitly annotate overrides of virtual functions or virtual
destructors with an override or (less frequently) final specifier.
Older (pre-C++11) code will use the virtual keyword as an inferior
alternative annotation. For clarity, use exactly one of override,
final, or virtual when declaring an override.
To better conform to these guidelines, the following constructs have
been rewritten:
- if a base class has a virtual destructor, then:
virtual ~Foo(); -> ~Foo() override;
- virtual void Foo() override; -> void Foo() override;
- virtual void Foo() override final; -> void Foo() final;
This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.
BUG=417463
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/645853012
Cr-Commit-Position: refs/heads/master@{#300925}
Diffstat (limited to 'gin')
-rw-r--r-- | gin/array_buffer.h | 6 | ||||
-rw-r--r-- | gin/interceptor_unittest.cc | 33 | ||||
-rw-r--r-- | gin/modules/module_registry_unittest.cc | 2 | ||||
-rw-r--r-- | gin/modules/module_runner_delegate.h | 8 | ||||
-rw-r--r-- | gin/modules/timer.h | 10 | ||||
-rw-r--r-- | gin/modules/timer_unittest.cc | 5 | ||||
-rw-r--r-- | gin/per_context_data.h | 2 | ||||
-rw-r--r-- | gin/public/v8_platform.h | 10 | ||||
-rw-r--r-- | gin/run_microtasks_observer.h | 4 | ||||
-rw-r--r-- | gin/shell/gin_main.cc | 3 | ||||
-rw-r--r-- | gin/shell_runner.h | 16 | ||||
-rw-r--r-- | gin/test/file_runner.h | 5 | ||||
-rw-r--r-- | gin/wrappable_unittest.cc | 15 |
13 files changed, 55 insertions, 64 deletions
diff --git a/gin/array_buffer.h b/gin/array_buffer.h index 048a35f..fe3fae2 100644 --- a/gin/array_buffer.h +++ b/gin/array_buffer.h @@ -16,9 +16,9 @@ namespace gin { class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: - virtual void* Allocate(size_t length) override; - virtual void* AllocateUninitialized(size_t length) override; - virtual void Free(void* data, size_t length) override; + void* Allocate(size_t length) override; + void* AllocateUninitialized(size_t length) override; + void Free(void* data, size_t length) override; GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); }; diff --git a/gin/interceptor_unittest.cc b/gin/interceptor_unittest.cc index d267100..4d2d7fb 100644 --- a/gin/interceptor_unittest.cc +++ b/gin/interceptor_unittest.cc @@ -31,9 +31,8 @@ class MyInterceptor : public Wrappable<MyInterceptor>, void set_value(int value) { value_ = value; } // gin::NamedPropertyInterceptor - virtual v8::Local<v8::Value> GetNamedProperty(v8::Isolate* isolate, - const std::string& property) - override { + v8::Local<v8::Value> GetNamedProperty(v8::Isolate* isolate, + const std::string& property) override { if (property == "value") { return ConvertToV8(isolate, value_); } else if (property == "func") { @@ -42,16 +41,16 @@ class MyInterceptor : public Wrappable<MyInterceptor>, return v8::Local<v8::Value>(); } } - virtual bool SetNamedProperty(v8::Isolate* isolate, - const std::string& property, - v8::Local<v8::Value> value) override { + bool SetNamedProperty(v8::Isolate* isolate, + const std::string& property, + v8::Local<v8::Value> value) override { if (property == "value") { ConvertFromV8(isolate, value, &value_); return true; } return false; } - virtual std::vector<std::string> EnumerateNamedProperties( + std::vector<std::string> EnumerateNamedProperties( v8::Isolate* isolate) override { std::vector<std::string> result; result.push_back("func"); @@ -60,15 +59,15 @@ class MyInterceptor : public Wrappable<MyInterceptor>, } // gin::IndexedPropertyInterceptor - virtual v8::Local<v8::Value> GetIndexedProperty(v8::Isolate* isolate, - uint32_t index) override { + v8::Local<v8::Value> GetIndexedProperty(v8::Isolate* isolate, + uint32_t index) override { if (index == 0) return ConvertToV8(isolate, value_); return v8::Local<v8::Value>(); } - virtual bool SetIndexedProperty(v8::Isolate* isolate, - uint32_t index, - v8::Local<v8::Value> value) override { + bool SetIndexedProperty(v8::Isolate* isolate, + uint32_t index, + v8::Local<v8::Value> value) override { if (index == 0) { ConvertFromV8(isolate, value, &value_); return true; @@ -76,8 +75,8 @@ class MyInterceptor : public Wrappable<MyInterceptor>, // Don't allow bypassing the interceptor. return true; } - virtual std::vector<uint32_t> EnumerateIndexedProperties(v8::Isolate* isolate) - override { + std::vector<uint32_t> EnumerateIndexedProperties( + v8::Isolate* isolate) override { std::vector<uint32_t> result; result.push_back(0); return result; @@ -89,11 +88,11 @@ class MyInterceptor : public Wrappable<MyInterceptor>, IndexedPropertyInterceptor(isolate, this), value_(0), template_cache_(isolate) {} - virtual ~MyInterceptor() {} + ~MyInterceptor() override {} // gin::Wrappable - virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) - override { + ObjectTemplateBuilder GetObjectTemplateBuilder( + v8::Isolate* isolate) override { return Wrappable<MyInterceptor>::GetObjectTemplateBuilder(isolate) .AddNamedPropertyInterceptor() .AddIndexedPropertyInterceptor(); diff --git a/gin/modules/module_registry_unittest.cc b/gin/modules/module_registry_unittest.cc index 57bc02d..3d784dc 100644 --- a/gin/modules/module_registry_unittest.cc +++ b/gin/modules/module_registry_unittest.cc @@ -35,7 +35,7 @@ class ModuleRegistryObserverImpl : public ModuleRegistryObserver { public: ModuleRegistryObserverImpl() : did_add_count_(0) {} - virtual void OnDidAddPendingModule( + void OnDidAddPendingModule( const std::string& id, const std::vector<std::string>& dependencies) override { did_add_count_++; diff --git a/gin/modules/module_runner_delegate.h b/gin/modules/module_runner_delegate.h index 421e23a..bd174f0 100644 --- a/gin/modules/module_runner_delegate.h +++ b/gin/modules/module_runner_delegate.h @@ -26,7 +26,7 @@ class GIN_EXPORT ModuleRunnerDelegate : public ShellRunnerDelegate { public: explicit ModuleRunnerDelegate( const std::vector<base::FilePath>& search_paths); - virtual ~ModuleRunnerDelegate(); + ~ModuleRunnerDelegate() override; void AddBuiltinModule(const std::string& id, ModuleGetter getter); void AddBuiltinModule(const std::string& id, @@ -39,11 +39,11 @@ class GIN_EXPORT ModuleRunnerDelegate : public ShellRunnerDelegate { typedef std::map<std::string, ModuleGetterCallback> BuiltinModuleMap; // From ShellRunnerDelegate: - virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate( + v8::Handle<v8::ObjectTemplate> GetGlobalTemplate( ShellRunner* runner, v8::Isolate* isolate) override; - virtual void DidCreateContext(ShellRunner* runner) override; - virtual void DidRunScript(ShellRunner* runner) override; + void DidCreateContext(ShellRunner* runner) override; + void DidRunScript(ShellRunner* runner) override; BuiltinModuleMap builtin_modules_; FileModuleProvider module_provider_; diff --git a/gin/modules/timer.h b/gin/modules/timer.h index 6284668..4913477 100644 --- a/gin/modules/timer.h +++ b/gin/modules/timer.h @@ -29,13 +29,12 @@ class GIN_EXPORT Timer : public Wrappable<Timer> { static Handle<Timer> Create(TimerType type, v8::Isolate* isolate, int delay_ms, v8::Handle<v8::Function> function); - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) override; + ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) override; private: Timer(v8::Isolate* isolate, bool repeating, int delay_ms, v8::Handle<v8::Function> function); - virtual ~Timer(); + ~Timer() override; void OnTimerFired(); base::Timer timer_; @@ -55,10 +54,9 @@ class GIN_EXPORT TimerModule : public Wrappable<TimerModule> { private: TimerModule(); - virtual ~TimerModule(); + ~TimerModule() override; - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) override; + ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) override; }; } // namespace gin diff --git a/gin/modules/timer_unittest.cc b/gin/modules/timer_unittest.cc index 42d7050..705bdc5 100644 --- a/gin/modules/timer_unittest.cc +++ b/gin/modules/timer_unittest.cc @@ -37,10 +37,9 @@ class Result : public Wrappable<Result> { Result() : count_(0) { } - virtual ~Result() { - } + ~Result() override {} - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( + ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override { return Wrappable<Result>::GetObjectTemplateBuilder(isolate) .SetProperty("count", &Result::count, &Result::set_count) diff --git a/gin/per_context_data.h b/gin/per_context_data.h index 0d11653..de8f179 100644 --- a/gin/per_context_data.h +++ b/gin/per_context_data.h @@ -24,7 +24,7 @@ class GIN_EXPORT PerContextData : public base::SupportsUserData { public: PerContextData(ContextHolder* context_holder, v8::Handle<v8::Context> context); - virtual ~PerContextData(); + ~PerContextData() override; // Can return NULL after the ContextHolder has detached from context. static PerContextData* From(v8::Handle<v8::Context> context); diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h index 59e2147..a4fc28a 100644 --- a/gin/public/v8_platform.h +++ b/gin/public/v8_platform.h @@ -19,17 +19,17 @@ class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) { static V8Platform* Get(); // v8::Platform implementation. - virtual void CallOnBackgroundThread( + void CallOnBackgroundThread( v8::Task* task, v8::Platform::ExpectedRuntime expected_runtime) override; - virtual void CallOnForegroundThread(v8::Isolate* isolate, - v8::Task* task) override; - virtual double MonotonicallyIncreasingTime() override; + void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override; + double MonotonicallyIncreasingTime() override; + private: friend struct base::DefaultLazyInstanceTraits<V8Platform>; V8Platform(); - virtual ~V8Platform(); + ~V8Platform() override; DISALLOW_COPY_AND_ASSIGN(V8Platform); }; diff --git a/gin/run_microtasks_observer.h b/gin/run_microtasks_observer.h index d31d804..7f1431f 100644 --- a/gin/run_microtasks_observer.h +++ b/gin/run_microtasks_observer.h @@ -18,8 +18,8 @@ class RunMicrotasksObserver : public base::MessageLoop::TaskObserver { public: RunMicrotasksObserver(v8::Isolate* isolate); - virtual void WillProcessTask(const base::PendingTask& pending_task) override; - virtual void DidProcessTask(const base::PendingTask& pending_task) override; + void WillProcessTask(const base::PendingTask& pending_task) override; + void DidProcessTask(const base::PendingTask& pending_task) override; private: v8::Isolate* isolate_; diff --git a/gin/shell/gin_main.cc b/gin/shell/gin_main.cc index 77b167a..b17ec0a 100644 --- a/gin/shell/gin_main.cc +++ b/gin/shell/gin_main.cc @@ -44,8 +44,7 @@ class GinShellRunnerDelegate : public ModuleRunnerDelegate { AddBuiltinModule(Console::kModuleName, Console::GetModule); } - virtual void UnhandledException(ShellRunner* runner, - TryCatch& try_catch) override { + void UnhandledException(ShellRunner* runner, TryCatch& try_catch) override { ModuleRunnerDelegate::UnhandledException(runner, try_catch); LOG(ERROR) << try_catch.GetStackTrace(); } diff --git a/gin/shell_runner.h b/gin/shell_runner.h index ca88a5d..9a5b4ef 100644 --- a/gin/shell_runner.h +++ b/gin/shell_runner.h @@ -37,19 +37,19 @@ class GIN_EXPORT ShellRunnerDelegate { class GIN_EXPORT ShellRunner : public Runner { public: ShellRunner(ShellRunnerDelegate* delegate, v8::Isolate* isolate); - virtual ~ShellRunner(); + ~ShellRunner() override; // Before running script in this context, you'll need to enter the runner's // context by creating an instance of Runner::Scope on the stack. // Runner overrides: - virtual void Run(const std::string& source, - const std::string& resource_name) override; - virtual v8::Handle<v8::Value> Call(v8::Handle<v8::Function> function, - v8::Handle<v8::Value> receiver, - int argc, - v8::Handle<v8::Value> argv[]) override; - virtual ContextHolder* GetContextHolder() override; + void Run(const std::string& source, + const std::string& resource_name) override; + v8::Handle<v8::Value> Call(v8::Handle<v8::Function> function, + v8::Handle<v8::Value> receiver, + int argc, + v8::Handle<v8::Value> argv[]) override; + ContextHolder* GetContextHolder() override; private: friend class Scope; diff --git a/gin/test/file_runner.h b/gin/test/file_runner.h index 5082cd5..9f7ab4b 100644 --- a/gin/test/file_runner.h +++ b/gin/test/file_runner.h @@ -20,12 +20,11 @@ namespace gin { class FileRunnerDelegate : public ModuleRunnerDelegate { public: FileRunnerDelegate(); - virtual ~FileRunnerDelegate(); + ~FileRunnerDelegate() override; private: // From ModuleRunnerDelegate: - virtual void UnhandledException(ShellRunner* runner, - TryCatch& try_catch) override; + void UnhandledException(ShellRunner* runner, TryCatch& try_catch) override; DISALLOW_COPY_AND_ASSIGN(FileRunnerDelegate); }; diff --git a/gin/wrappable_unittest.cc b/gin/wrappable_unittest.cc index 0e10c32..8dbaf30 100644 --- a/gin/wrappable_unittest.cc +++ b/gin/wrappable_unittest.cc @@ -40,9 +40,8 @@ class MyObject : public BaseClass, protected: MyObject() : value_(0) {} - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) override; - virtual ~MyObject() {} + ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) override; + ~MyObject() override {} private: int value_; @@ -61,7 +60,7 @@ class MyObjectSubclass : public MyObject { std::string result; private: - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( + ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override { return MyObject::GetObjectTemplateBuilder(isolate) .SetMethod("sayHello", &MyObjectSubclass::SayHello); @@ -70,8 +69,7 @@ class MyObjectSubclass : public MyObject { MyObjectSubclass() { } - virtual ~MyObjectSubclass() { - } + ~MyObjectSubclass() override {} }; class MyCallableObject : public Wrappable<MyCallableObject> { @@ -85,7 +83,7 @@ class MyCallableObject : public Wrappable<MyCallableObject> { int result() { return result_; } private: - virtual ObjectTemplateBuilder GetObjectTemplateBuilder( + ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override { return Wrappable<MyCallableObject>::GetObjectTemplateBuilder(isolate) .SetCallAsFunctionHandler(&MyCallableObject::Call); @@ -94,8 +92,7 @@ class MyCallableObject : public Wrappable<MyCallableObject> { MyCallableObject() : result_(0) { } - virtual ~MyCallableObject() { - } + ~MyCallableObject() override {} void Call(int val, const gin::Arguments& arguments) { if (arguments.IsConstructCall()) |