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

Side by Side Diff: content/browser/streams/stream_registry.cc

Issue 12212031: Add support for redirecting ResourceHandlers to a blob: URL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fixes 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 #include "content/browser/streams/stream_registry.h"
6
7 #include <string>
8
9 #include "base/guid.h"
10 #include "base/stl_util.h"
11 #include "base/string_number_conversions.h"
12 #include "content/browser/streams/stream.h"
13 #include "content/public/common/url_constants.h"
14
15 namespace content {
16
17 StreamRegistry::StreamRegistry() {
18 }
19
20 StreamRegistry::~StreamRegistry() {
21 }
22
23 void StreamRegistry::RegisterStream(scoped_refptr<Stream> stream) {
24 GURL url(std::string(chrome::kBlobScheme) + ":" +
25 stream->security_origin().spec() +
26 base::GenerateGUID());
27 stream->SetStreamUrl(url);
28 streams_[url] = stream;
29 }
30
31 scoped_refptr<Stream> StreamRegistry::GetStream(const GURL& url) {
32 std::map<GURL, scoped_refptr<Stream> >::iterator stream = streams_.find(url);
33 if (stream != streams_.end()) {
34 return stream->second;
35 } else {
36 return NULL;
37 }
38 }
39
40 void StreamRegistry::OnStreamConsumed(Stream* stream) {
41 streams_.erase(stream->stream_url());
42 }
43
44 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_registry.h ('k') | content/browser/streams/stream_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698