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

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

Issue 611153004: replace OVERRIDE and FINAL with override and final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CC_ -> 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
« no previous file with comments | « base/memory/ref_counted_memory.h ('k') | base/memory/scoped_vector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 virtual void SetPtr(int* ptr) override { ptr_ = ptr; ++*ptr_; }
31 31
32 virtual int SomeMeth(int x) const OVERRIDE { return x; } 32 virtual int SomeMeth(int x) const override { return x; }
33 33
34 private: 34 private:
35 int* ptr_; 35 int* ptr_;
36 36
37 DISALLOW_COPY_AND_ASSIGN(ConDecLogger); 37 DISALLOW_COPY_AND_ASSIGN(ConDecLogger);
38 }; 38 };
39 39
40 struct CountingDeleter { 40 struct CountingDeleter {
41 explicit CountingDeleter(int* count) : count_(count) {} 41 explicit CountingDeleter(int* count) : count_(count) {}
42 inline void operator()(double* ptr) const { 42 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); 649 scoped_ptr<Sub> sub2(new Sub);
650 650
651 // Upcast with Pass() works. 651 // Upcast with Pass() works.
652 scoped_ptr<Super> super1 = sub1.Pass(); 652 scoped_ptr<Super> super1 = sub1.Pass();
653 super1 = sub2.Pass(); 653 super1 = sub2.Pass();
654 654
655 // Upcast with an rvalue works. 655 // Upcast with an rvalue works.
656 scoped_ptr<Super> super2 = SubClassReturn(); 656 scoped_ptr<Super> super2 = SubClassReturn();
657 super2 = SubClassReturn(); 657 super2 = SubClassReturn();
658 } 658 }
OLDNEW
« no previous file with comments | « base/memory/ref_counted_memory.h ('k') | base/memory/scoped_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698