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

Side by Side Diff: Source/core/fileapi/Stream.cpp

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 namespace WebCore { 38 namespace WebCore {
39 39
40 Stream::Stream(const String& mediaType) 40 Stream::Stream(const String& mediaType)
41 : m_mediaType(mediaType) 41 : m_mediaType(mediaType)
42 , m_isNeutered(false) 42 , m_isNeutered(false)
43 { 43 {
44 ScriptWrappable::init(this); 44 ScriptWrappable::init(this);
45 45
46 // Create a new internal URL for a stream and register it with the provided 46 // Create a new internal URL for a stream and register it with the provided
47 // media type. 47 // media type.
48 m_internalURL = BlobURL::createInternalURL(); 48 m_internalURL = BlobURL::createInternalStreamURL();
49 BlobRegistry::registerStreamURL(m_internalURL, m_mediaType); 49 BlobRegistry::registerStreamURL(m_internalURL, m_mediaType);
50 } 50 }
51 51
52 void Stream::addData(const char* data, size_t len) 52 void Stream::addData(const char* data, size_t len)
53 { 53 {
54 RefPtr<RawData> buffer(RawData::create()); 54 RefPtr<RawData> buffer(RawData::create());
55 buffer->mutableData()->resize(len); 55 buffer->mutableData()->resize(len);
56 memcpy(buffer->mutableData()->data(), data, len); 56 memcpy(buffer->mutableData()->data(), data, len);
57 BlobRegistry::addDataToStream(m_internalURL, buffer); 57 BlobRegistry::addDataToStream(m_internalURL, buffer);
58 } 58 }
59 59
60 void Stream::finalize() 60 void Stream::finalize()
61 { 61 {
62 BlobRegistry::finalizeStream(m_internalURL); 62 BlobRegistry::finalizeStream(m_internalURL);
63 } 63 }
64 64
65 void Stream::abort() 65 void Stream::abort()
66 { 66 {
67 BlobRegistry::abortStream(m_internalURL); 67 BlobRegistry::abortStream(m_internalURL);
68 } 68 }
69 69
70 Stream::~Stream() 70 Stream::~Stream()
71 { 71 {
72 BlobRegistry::unregisterStreamURL(m_internalURL); 72 BlobRegistry::unregisterStreamURL(m_internalURL);
73 } 73 }
74 74
75 } // namespace WebCore 75 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698