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

Side by Side Diff: chrome/browser/chromeos/cros/cros_library.cc

Issue 16871010: Rewrite scoped_ptr<T>(NULL) to use the default ctor in chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/drive_integration_service_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 "chrome/browser/chromeos/cros/cros_library.h" 5 #include "chrome/browser/chromeos/cros/cros_library.h"
6 6
7 #include "chrome/browser/chromeos/cros/network_library.h" 7 #include "chrome/browser/chromeos/cros/network_library.h"
8 8
9 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \ 9 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \
10 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \ 10 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \
11 return var_prefix##_lib_.GetDefaultImpl(use_stub_impl_); \ 11 return var_prefix##_lib_.GetDefaultImpl(use_stub_impl_); \
12 } 12 }
13 13
14 #define DEFINE_SET_LIBRARY_METHOD(class_prefix, var_prefix) \ 14 #define DEFINE_SET_LIBRARY_METHOD(class_prefix, var_prefix) \
15 void CrosLibrary::TestApi::Set##class_prefix##Library( \ 15 void CrosLibrary::TestApi::Set##class_prefix##Library( \
16 class_prefix##Library* library, bool own) { \ 16 class_prefix##Library* library, bool own) { \
17 library_->var_prefix##_lib_.SetImpl(library, own); \ 17 library_->var_prefix##_lib_.SetImpl(library, own); \
18 } 18 }
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 static CrosLibrary* g_cros_library = NULL; 22 static CrosLibrary* g_cros_library = NULL;
23 23
24 CrosLibrary::CrosLibrary(bool use_stub) 24 CrosLibrary::CrosLibrary(bool use_stub) : use_stub_impl_(use_stub) {}
25 : use_stub_impl_(use_stub),
26 test_api_(NULL) {
27 }
28 25
29 CrosLibrary::~CrosLibrary() { 26 CrosLibrary::~CrosLibrary() {
30 } 27 }
31 28
32 // static 29 // static
33 void CrosLibrary::Initialize(bool use_stub) { 30 void CrosLibrary::Initialize(bool use_stub) {
34 CHECK(!g_cros_library) << "CrosLibrary: Multiple calls to Initialize()."; 31 CHECK(!g_cros_library) << "CrosLibrary: Multiple calls to Initialize().";
35 g_cros_library = new CrosLibrary(use_stub); 32 g_cros_library = new CrosLibrary(use_stub);
36 VLOG_IF(1, use_stub) << "CrosLibrary Initialized with Stub Impl."; 33 VLOG_IF(1, use_stub) << "CrosLibrary Initialized with Stub Impl.";
37 } 34 }
(...skipping 16 matching lines...) Expand all
54 51
55 CrosLibrary::TestApi* CrosLibrary::GetTestApi() { 52 CrosLibrary::TestApi* CrosLibrary::GetTestApi() {
56 if (!test_api_.get()) 53 if (!test_api_.get())
57 test_api_.reset(new TestApi(this)); 54 test_api_.reset(new TestApi(this));
58 return test_api_.get(); 55 return test_api_.get();
59 } 56 }
60 57
61 DEFINE_SET_LIBRARY_METHOD(Network, network); 58 DEFINE_SET_LIBRARY_METHOD(Network, network);
62 59
63 } // namespace chromeos 60 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/drive_integration_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698