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 "base/threading/non_thread_safe.h" |
| 13 #include "content/browser/streams/stream.h" |
| 14 #include "googleurl/src/gurl.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // Maintains a mapping of blob: URLs to active streams. |
| 19 class StreamRegistry : public base::NonThreadSafe { |
| 20 public: |
| 21 StreamRegistry(); |
| 22 virtual ~StreamRegistry(); |
| 23 |
| 24 // Registers a stream, and sets its URL. |
| 25 void RegisterStream(scoped_refptr<Stream> stream); |
| 26 |
| 27 // Clones a stream. |
| 28 void CloneStream(const GURL& url, const GURL& src_url); |
| 29 |
| 30 void UnregisterStream(const GURL& url); |
| 31 |
| 32 // Gets the stream associated with |url|. Returns NULL if there is no such |
| 33 // stream. |
| 34 scoped_refptr<Stream> GetStream(const GURL& url); |
| 35 |
| 36 private: |
| 37 std::map<GURL, scoped_refptr<Stream> > streams_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(StreamRegistry); |
| 40 }; |
| 41 |
| 42 } // namespace content |
| 43 |
| 44 #endif // CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ |
| 45 |
| 46 |
OLD | NEW |