summaryrefslogtreecommitdiffstats
path: root/content/browser/streams/stream_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Standardize usage of virtual/override/final specifiers in content/.dcheng2014-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. Several formatting edits by clang-format were manually reverted, due to mangling of some of the more complicate IPC macros. BUG=417463 Review URL: https://codereview.chromium.org/823713002 Cr-Commit-Position: refs/heads/master@{#309497}
* Introduce StreamRegistry::RegisterReaderAbortedStream()horo2014-12-121-3/+12
| | | | | | | | | | | | | | | | | | | | | | | If the reader of the stream is aborted before the stream is registered, StreamRegistry::RegisterStream() should fail to reduce the memory consumption. So this change introduces StreamRegistry::RegisterReaderAbortedStream(). We will use this method in this situation: - The request from the page is sent to the ServiceWorker. - The ServiceWorker creates a Stream and starts uploading the data to the browser process with it. - The browser process receives the stream URL in ServiceWorkerHostMsg_FetchEventFinished. But it didn't receive StreamHostMsg_StartBuilding yet. - The page stops the loading the resource. -> Call this method in the browser process. - The browser receives StreamHostMsg_StartBuilding and creates a Stream and registers it to the StreamRegistry. -> This registration should fail. BUG=436424 TEST=content_unittests --gtest_filter=StreamTest.* Review URL: https://codereview.chromium.org/759823003 Cr-Commit-Position: refs/heads/master@{#308025}
* Introduce Stream::flush [2/2 chromium]horo2014-12-101-0/+28
| | | | | | | | | | | | | | | | | There is no way to flush the buffer in the stream. This cl introduces Stream::flush method. We can flush the buffer in the browser process using this method from blink. We will use this method when we send the data from the ServiceWorker to the browser process progressively. 1/2 blink: https://codereview.chromium.org/747323007/ 2/2 chromium: https://codereview.chromium.org/760823002/ BUG=436424 Review URL: https://codereview.chromium.org/760823002 Cr-Commit-Position: refs/heads/master@{#307684}
* Introduce StreamRegisterObserver.horo2014-11-261-0/+40
| | | | | | | | | | | | | | | | | | | | | | | We are planing to use Streams to send the data from the ServiceWorker to the browser process when FetchEvent.respondWith() is called. (crbug.com/436424) When FetchEvent.respondWith() is called, we will create a blink::Stream and get the stream URL of it and send ServiceWorkerHostMsg_FetchEventFinished message with the stream URL to the browser process. And after that the ServiceWorker reads the body of the response and sends the data to the browser process using the Stream. When we call blink::Stream::create() in the worker thread, StreamHostMsg_StartBuilding message is sent from the main thread. And when the browser process receives this message, StreamRegistry::RegisterStream() is called. But ServiceWorkerHostMsg_FetchEventFinished is sent from the worker thread. So when the browser receives the FetchEventFinished message, StreamRegistry::RegisterStream() may not be called yet. To support this condition we need to introduce StreamRegisterObserver. When he browser process receives the FetchEventFinished message, it gets the Stream by calling StreamRegistry::GetStream(). And if it fails it registers a StreamRegisterObserver and waits for StreamHostMsg_StartBuilding message. BUG=436424 TEST=content_unittests --gtest_filter=StreamTest.* Review URL: https://codereview.chromium.org/755233002 Cr-Commit-Position: refs/heads/master@{#305792}
* Standardize usage of virtual/override/final specifiers.dcheng2014-10-281-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. BUG=417463 R=nasko@chromium.org Review URL: https://codereview.chromium.org/678073006 Cr-Commit-Position: refs/heads/master@{#301534}
* Standardize usage of virtual/override/final in content/browser/dcheng2014-10-211-9/+5
| | | | | | | | | | | | This patch was automatically generated by applying clang fixit hints generated by the plugin to the source tree. BUG=417463 TBR=sky@chromium.org Review URL: https://codereview.chromium.org/667943003 Cr-Commit-Position: refs/heads/master@{#300469}
* Replace FINAL and OVERRIDE with their C++11 counterparts in contentmohan.reddy2014-10-091-4/+4
| | | | | | | | | | | This step is a giant search and replace for OVERRIDE and FINAL to replace them with their lowercase versions. BUG=417463 Review URL: https://codereview.chromium.org/637183002 Cr-Commit-Position: refs/heads/master@{#298804}
* Make Stream return STREAM_ABORTED to tell the reader it's failed.tyoshino@chromium.org2013-08-231-0/+3
| | | | | | | | | | | | | | Using this, StreamURLRequestJob aborts itself. For now, this value will be used to deal with memory limit exceed. data_bytes_read_ is moved using this opportunity since it's a part of temporary buffer consists of data_ and data_length_. BUG=169957 Review URL: https://chromiumcodereview.appspot.com/22942003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219170 0039d316-1c4b-4281-b951-d872f2087c98
* Limit the total memory usage for Stream instancestyoshino@chromium.org2013-08-221-0/+55
| | | | | | | | | | | | | | | | Stream instances report their memory usage to StreamRegistry to get approval. If rejected, they unregisters themselves. writer_ and reader_ are cleared immediately when memory usage violation happens. Added task runner DCHECKs to ByteStreamReaderImpl and ByteStreamWriterImpl so that we can check we're not violating thread restriction. BUG=169957 Review URL: https://chromiumcodereview.appspot.com/22908008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218933 0039d316-1c4b-4281-b951-d872f2087c98
* Test that Stream::ReadRawData doesn't return STREAM_EMPTY once Finalized.tyoshino@chromium.org2013-08-141-4/+47
| | | | | | | | | | | | | Check that once Stream::Finalize() is called and reader_ receives that, reader_.ReadRawData() never returns STREAM_EMPTY. Also removed unnecessary reader.Read() call. BUG=272640 Review URL: https://chromiumcodereview.appspot.com/23007003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217514 0039d316-1c4b-4281-b951-d872f2087c98
* Remove security_origin member from content::Stream.tyoshino@chromium.org2013-07-261-9/+9
| | | | | | | | | | | | | | | | | | | | Stream::security_origin_ is not used at all for now. There's no established code in Chromium to do origin checking. Security of Blob/Stream resource loading now depends on origin checking mechanism in Blink. Keeping this variable without having any checking mechanism confuses developers. Remove it until we build origin checking code in Chromium. Also, rename security_origin to origin, as it's nothing but an origin URL. BUG=263342 Review URL: https://chromiumcodereview.appspot.com/19798012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213830 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of the message_loop header in content/, part 2.avi@chromium.org2013-07-181-1/+1
| | | | | | | | | | BUG=260807 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/19618002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212184 0039d316-1c4b-4281-b951-d872f2087c98
* Update content/ to use scoped_refptr<T>::get() rather than implicit ↵rsleevi@chromium.org2013-06-021-6/+6
| | | | | | | | | | | | | "operator T*" Linux fixes BUG=110610 TBR=darin Review URL: https://chromiumcodereview.appspot.com/16294003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203624 0039d316-1c4b-4281-b951-d872f2087c98
* content: Use base::MessageLoop.xhwang@chromium.org2013-05-041-2/+2
| | | | | | | | | BUG=236029 R=avi@chromium.org Review URL: https://chromiumcodereview.appspot.com/14335017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198316 0039d316-1c4b-4281-b951-d872f2087c98
* Add Resource Handler for creating Streams to forward to extensionszork@chromium.org2013-03-201-0/+3
| | | | | | | | | BUG=171585 Review URL: https://chromiumcodereview.appspot.com/12645004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189172 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r187230: Implement the Stream registry in contentzork@chromium.org2013-03-131-0/+207
| | | | | | | | | | | This fixes the memory leaks introduced by the original CL. BUG=171585 Review URL: https://chromiumcodereview.appspot.com/12637006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187777 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 187230zork@chromium.org2013-03-111-207/+0
| | | | | | | | | | | | | | | | | | | > Implement the Stream registry in content > > This is the first part of the content side of the Streams api. > See: > https://bugs.webkit.org/show_bug.cgi?id=110194 > https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm > > BUG=171585 > > > Review URL: https://chromiumcodereview.appspot.com/12335087 TBR=zork@chromium.org Review URL: https://codereview.chromium.org/12611018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187274 0039d316-1c4b-4281-b951-d872f2087c98
* Implement the Stream registry in contentzork@chromium.org2013-03-111-0/+207
This is the first part of the content side of the Streams api. See: https://bugs.webkit.org/show_bug.cgi?id=110194 https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm BUG=171585 Review URL: https://chromiumcodereview.appspot.com/12335087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187230 0039d316-1c4b-4281-b951-d872f2087c98