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

Side by Side Diff: content/browser/streams/stream_registry.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 | « content/browser/streams/stream_context.cc ('k') | content/browser/streams/stream_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/streams/stream_registry.h" 5 #include "content/browser/streams/stream_registry.h"
6 6
7 #include "content/browser/streams/stream.h" 7 #include "content/browser/streams/stream.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 StreamRegistry::StreamRegistry() { 11 StreamRegistry::StreamRegistry() {
12 } 12 }
13 13
14 StreamRegistry::~StreamRegistry() { 14 StreamRegistry::~StreamRegistry() {
15 } 15 }
16 16
17 void StreamRegistry::RegisterStream(scoped_refptr<Stream> stream) { 17 void StreamRegistry::RegisterStream(scoped_refptr<Stream> stream) {
18 DCHECK(CalledOnValidThread()); 18 DCHECK(CalledOnValidThread());
19 DCHECK(stream); 19 DCHECK(stream.get());
20 DCHECK(!stream->url().is_empty()); 20 DCHECK(!stream->url().is_empty());
21 streams_[stream->url()] = stream; 21 streams_[stream->url()] = stream;
22 } 22 }
23 23
24 scoped_refptr<Stream> StreamRegistry::GetStream(const GURL& url) { 24 scoped_refptr<Stream> StreamRegistry::GetStream(const GURL& url) {
25 DCHECK(CalledOnValidThread()); 25 DCHECK(CalledOnValidThread());
26 StreamMap::const_iterator stream = streams_.find(url); 26 StreamMap::const_iterator stream = streams_.find(url);
27 if (stream != streams_.end()) 27 if (stream != streams_.end())
28 return stream->second; 28 return stream->second;
29 29
30 return NULL; 30 return NULL;
31 } 31 }
32 32
33 bool StreamRegistry::CloneStream(const GURL& url, const GURL& src_url) { 33 bool StreamRegistry::CloneStream(const GURL& url, const GURL& src_url) {
34 DCHECK(CalledOnValidThread()); 34 DCHECK(CalledOnValidThread());
35 scoped_refptr<Stream> stream(GetStream(src_url)); 35 scoped_refptr<Stream> stream(GetStream(src_url));
36 if (stream) { 36 if (stream.get()) {
37 streams_[url] = stream; 37 streams_[url] = stream;
38 return true; 38 return true;
39 } 39 }
40 return false; 40 return false;
41 } 41 }
42 42
43 void StreamRegistry::UnregisterStream(const GURL& url) { 43 void StreamRegistry::UnregisterStream(const GURL& url) {
44 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
45 streams_.erase(url); 45 streams_.erase(url);
46 } 46 }
47 47
48 } // namespace content 48 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_context.cc ('k') | content/browser/streams/stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698