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

Side by Side Diff: content/browser/streams/chrome_stream_context.h

Issue 12212031: Add support for redirecting ResourceHandlers to a blob: URL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 10 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
OLDNEW
(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_CHROME_STREAM_CONTEXT_H_
6 #define CONTENT_BROWSER_STREAMS_CHROME_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
12 namespace content {
13 class BrowserContext;
14 struct ChromeStreamContextDeleter;
15 class ChromeStreamRegistry;
16
17 // A context class that keeps track of ChromeStreamRegistry 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 ChromeStreamContext
25 : public base::RefCountedThreadSafe<ChromeStreamContext,
26 ChromeStreamContextDeleter> {
27 public:
28 ChromeStreamContext();
29
30 static ChromeStreamContext* GetFor(BrowserContext* browser_context);
31
32 void InitializeOnIOThread();
33
34 ChromeStreamRegistry* registry() const { return registry_.get(); }
35
36 protected:
37 virtual ~ChromeStreamContext();
38
39 private:
40 friend class base::DeleteHelper<ChromeStreamContext>;
41 friend class base::RefCountedThreadSafe<ChromeStreamContext,
42 ChromeStreamContextDeleter>;
43 friend struct ChromeStreamContextDeleter;
44
45 void DeleteOnCorrectThread() const;
46
47 scoped_ptr<ChromeStreamRegistry> registry_;
48 };
49
50 struct ChromeStreamContextDeleter {
51 static void Destruct(const ChromeStreamContext* context) {
52 context->DeleteOnCorrectThread();
53 }
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_BROWSER_STREAMS_CHROME_STREAM_CONTEXT_H_
59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698