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_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_STREAMS_STREAM_CONTEXT_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/sequenced_task_runner_helpers.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 |
| 13 namespace content { |
| 14 class BrowserContext; |
| 15 class StreamRegistry; |
| 16 |
| 17 // A context class that keeps track of StreamRegistry used by the chrome. |
| 18 // There is an instance associated with each BrowserContext. There could be |
| 19 // multiple URLRequestContexts in the same browser context that refers to the |
| 20 // same instance. |
| 21 // |
| 22 // All methods, except the ctor, are expected to be called on |
| 23 // the IO thread (unless specifically called out in doc comments). |
| 24 class StreamContext |
| 25 : public base::RefCountedThreadSafe<StreamContext, |
| 26 BrowserThread::DeleteOnIOThread> { |
| 27 public: |
| 28 StreamContext(); |
| 29 |
| 30 static StreamContext* GetFor(BrowserContext* browser_context); |
| 31 |
| 32 void InitializeOnIOThread(); |
| 33 |
| 34 StreamRegistry* registry() const { return registry_.get(); } |
| 35 |
| 36 protected: |
| 37 virtual ~StreamContext(); |
| 38 |
| 39 private: |
| 40 friend class base::DeleteHelper<StreamContext>; |
| 41 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 42 |
| 43 scoped_ptr<StreamRegistry> registry_; |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_BROWSER_STREAMS_STREAM_CONTEXT_H_ |
| 49 |
OLD | NEW |