Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: base/memory/scoped_ptr_unittest.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace { 12 namespace {
13 13
14 // Used to test depth subtyping. 14 // Used to test depth subtyping.
15 class ConDecLoggerParent { 15 class ConDecLoggerParent {
16 public: 16 public:
17 virtual ~ConDecLoggerParent() {} 17 virtual ~ConDecLoggerParent() {}
18 18
19 virtual void SetPtr(int* ptr) = 0; 19 virtual void SetPtr(int* ptr) = 0;
20 20
21 virtual int SomeMeth(int x) const = 0; 21 virtual int SomeMeth(int x) const = 0;
22 }; 22 };
23 23
24 class ConDecLogger : public ConDecLoggerParent { 24 class ConDecLogger : public ConDecLoggerParent {
25 public: 25 public:
26 ConDecLogger() : ptr_(NULL) { } 26 ConDecLogger() : ptr_(NULL) { }
27 explicit ConDecLogger(int* ptr) { SetPtr(ptr); } 27 explicit ConDecLogger(int* ptr) { SetPtr(ptr); }
28 virtual ~ConDecLogger() { --*ptr_; } 28 virtual ~ConDecLogger() { --*ptr_; }
29 29
30 virtual void SetPtr(int* ptr) OVERRIDE { ptr_ = ptr; ++*ptr_; } 30 void SetPtr(int* ptr) override {
31 ptr_ = ptr;
32 ++*ptr_;
33 }
31 34
32 virtual int SomeMeth(int x) const OVERRIDE { return x; } 35 int SomeMeth(int x) const override { return x; }
33 36
34 private: 37 private:
35 int* ptr_; 38 int* ptr_;
36 39
37 DISALLOW_COPY_AND_ASSIGN(ConDecLogger); 40 DISALLOW_COPY_AND_ASSIGN(ConDecLogger);
38 }; 41 };
39 42
40 struct CountingDeleter { 43 struct CountingDeleter {
41 explicit CountingDeleter(int* count) : count_(count) {} 44 explicit CountingDeleter(int* count) : count_(count) {}
42 inline void operator()(double* ptr) const { 45 inline void operator()(double* ptr) const {
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 scoped_ptr<Sub> sub2(new Sub); 652 scoped_ptr<Sub> sub2(new Sub);
650 653
651 // Upcast with Pass() works. 654 // Upcast with Pass() works.
652 scoped_ptr<Super> super1 = sub1.Pass(); 655 scoped_ptr<Super> super1 = sub1.Pass();
653 super1 = sub2.Pass(); 656 super1 = sub2.Pass();
654 657
655 // Upcast with an rvalue works. 658 // Upcast with an rvalue works.
656 scoped_ptr<Super> super2 = SubClassReturn(); 659 scoped_ptr<Super> super2 = SubClassReturn();
657 super2 = SubClassReturn(); 660 super2 = SubClassReturn();
658 } 661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698