Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | |
| 6 #define CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "content/browser/streams/stream.h" | |
| 13 #include "googleurl/src/gurl.h" | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 // Maintains a mapping of blob: URLs to active streams. | |
| 18 class StreamRegistry { | |
|
kinuko
2013/02/26 07:37:55
Can we make it inherit from base::NonThreadSafe an
Zachary Kuznia
2013/02/26 08:30:03
Done.
| |
| 19 public: | |
| 20 StreamRegistry(); | |
| 21 virtual ~StreamRegistry(); | |
| 22 | |
| 23 // Register a stream, and set its URL | |
| 24 void RegisterStream(scoped_refptr<Stream> stream); | |
| 25 | |
| 26 // Clone a stream | |
| 27 void CloneStream(const GURL& url, const GURL& src_url); | |
| 28 | |
| 29 void UnregisterStream(const GURL& url); | |
| 30 | |
| 31 // Get the stream associated with |url|. Returns NULL if there is no such | |
| 32 // stream. | |
| 33 scoped_refptr<Stream> GetStream(const GURL& url); | |
| 34 | |
| 35 void OnStreamConsumed(Stream* stream); | |
| 36 | |
| 37 private: | |
| 38 std::map<GURL, scoped_refptr<Stream> > streams_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(StreamRegistry); | |
| 41 }; | |
| 42 | |
| 43 } // namespace content | |
| 44 | |
| 45 #endif // CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | |
| 46 | |
| 47 | |
| OLD | NEW |