| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | 5 #ifndef CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ |
| 6 #define CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | 6 #define CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/threading/non_thread_safe.h" | 15 #include "base/sequence_checker.h" |
| 16 #include "content/browser/streams/stream_register_observer.h" | 16 #include "content/browser/streams/stream_register_observer.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class Stream; | 22 class Stream; |
| 23 | 23 |
| 24 // Maintains a mapping of blob: URLs to active streams. | 24 // Maintains a mapping of blob: URLs to active streams. |
| 25 class CONTENT_EXPORT StreamRegistry : public base::NonThreadSafe { | 25 class CONTENT_EXPORT StreamRegistry { |
| 26 public: | 26 public: |
| 27 StreamRegistry(); | 27 StreamRegistry(); |
| 28 virtual ~StreamRegistry(); | 28 virtual ~StreamRegistry(); |
| 29 | 29 |
| 30 // Registers a stream, and sets its URL. | 30 // Registers a stream, and sets its URL. |
| 31 void RegisterStream(Stream* stream); | 31 void RegisterStream(Stream* stream); |
| 32 | 32 |
| 33 // Clones a stream. Returns true on success, or false if |src_url| doesn't | 33 // Clones a stream. Returns true on success, or false if |src_url| doesn't |
| 34 // exist. | 34 // exist. |
| 35 bool CloneStream(const GURL& url, const GURL& src_url); | 35 bool CloneStream(const GURL& url, const GURL& src_url); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 StreamMap streams_; | 67 StreamMap streams_; |
| 68 std::map<GURL, StreamRegisterObserver*> register_observers_; | 68 std::map<GURL, StreamRegisterObserver*> register_observers_; |
| 69 std::set<GURL> reader_aborted_urls_; | 69 std::set<GURL> reader_aborted_urls_; |
| 70 | 70 |
| 71 size_t total_memory_usage_; | 71 size_t total_memory_usage_; |
| 72 | 72 |
| 73 // Maximum amount of memory allowed to use for Stream instances registered | 73 // Maximum amount of memory allowed to use for Stream instances registered |
| 74 // with this registry. | 74 // with this registry. |
| 75 size_t max_memory_usage_; | 75 size_t max_memory_usage_; |
| 76 | 76 |
| 77 SEQUENCE_CHECKER(sequence_checker_); |
| 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(StreamRegistry); | 79 DISALLOW_COPY_AND_ASSIGN(StreamRegistry); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace content | 82 } // namespace content |
| 81 | 83 |
| 82 #endif // CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ | 84 #endif // CONTENT_BROWSER_STREAMS_STREAM_REGISTRY_H_ |
| OLD | NEW |