Chromium Code Reviews

Side by Side Diff: webrtc/voice_engine/voice_engine_impl.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 13 matching lines...)
24 namespace webrtc { 24 namespace webrtc {
25 25
26 // Counter to be ensure that we can add a correct ID in all static trace 26 // Counter to be ensure that we can add a correct ID in all static trace
27 // methods. It is not the nicest solution, especially not since we already 27 // methods. It is not the nicest solution, especially not since we already
28 // have a counter in VoEBaseImpl. In other words, there is room for 28 // have a counter in VoEBaseImpl. In other words, there is room for
29 // improvement here. 29 // improvement here.
30 static int32_t gVoiceEngineInstanceCounter = 0; 30 static int32_t gVoiceEngineInstanceCounter = 0;
31 31
32 VoiceEngine* GetVoiceEngine() { 32 VoiceEngine* GetVoiceEngine() {
33 VoiceEngineImpl* self = new VoiceEngineImpl(); 33 VoiceEngineImpl* self = new VoiceEngineImpl();
34 if (self != NULL) { 34 if (self != nullptr) {
35 self->AddRef(); // First reference. Released in VoiceEngine::Delete. 35 self->AddRef(); // First reference. Released in VoiceEngine::Delete.
36 gVoiceEngineInstanceCounter++; 36 gVoiceEngineInstanceCounter++;
37 } 37 }
38 return self; 38 return self;
39 } 39 }
40 40
41 int VoiceEngineImpl::AddRef() { 41 int VoiceEngineImpl::AddRef() {
42 return ++_ref_count; 42 return ++_ref_count;
43 } 43 }
44 44
(...skipping 58 matching lines...)
103 } 103 }
104 104
105 int VoiceEngine::SetTraceCallback(TraceCallback* callback) { 105 int VoiceEngine::SetTraceCallback(TraceCallback* callback) {
106 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, 106 WEBRTC_TRACE(kTraceApiCall, kTraceVoice,
107 VoEId(gVoiceEngineInstanceCounter, -1), 107 VoEId(gVoiceEngineInstanceCounter, -1),
108 "SetTraceCallback(callback=0x%x)", callback); 108 "SetTraceCallback(callback=0x%x)", callback);
109 return (Trace::SetTraceCallback(callback)); 109 return (Trace::SetTraceCallback(callback));
110 } 110 }
111 111
112 bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) { 112 bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) {
113 if (voiceEngine == NULL) 113 if (voiceEngine == nullptr)
114 return false; 114 return false;
115 115
116 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); 116 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
117 // Release the reference that was added in GetVoiceEngine. 117 // Release the reference that was added in GetVoiceEngine.
118 int ref = s->Release(); 118 int ref = s->Release();
119 voiceEngine = NULL; 119 voiceEngine = nullptr;
120 120
121 if (ref != 0) { 121 if (ref != 0) {
122 WEBRTC_TRACE( 122 WEBRTC_TRACE(
123 kTraceWarning, kTraceVoice, -1, 123 kTraceWarning, kTraceVoice, -1,
124 "VoiceEngine::Delete did not release the very last reference. " 124 "VoiceEngine::Delete did not release the very last reference. "
125 "%d references remain.", 125 "%d references remain.",
126 ref); 126 ref);
127 } 127 }
128 128
129 return true; 129 return true;
(...skipping 14 matching lines...)
144 144
145 std::string VoiceEngine::GetVersionString() { 145 std::string VoiceEngine::GetVersionString() {
146 std::string version = "VoiceEngine 4.1.0"; 146 std::string version = "VoiceEngine 4.1.0";
147 #ifdef WEBRTC_EXTERNAL_TRANSPORT 147 #ifdef WEBRTC_EXTERNAL_TRANSPORT
148 version += " (External transport build)"; 148 version += " (External transport build)";
149 #endif 149 #endif
150 return version; 150 return version;
151 } 151 }
152 152
153 } // namespace webrtc 153 } // namespace webrtc
OLDNEW
« webrtc/base/event.cc ('K') | « webrtc/voice_engine/voe_volume_control_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine