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

Side by Side Diff: webkit/media/buffered_resource_loader.cc

Issue 8570010: Moving media-related files from webkit/glue/ to webkit/media/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: minor fixes Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/media/buffered_resource_loader.h" 5 #include "webkit/media/buffered_resource_loader.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "media/base/media_log.h" 10 #include "media/base/media_log.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/http/http_request_headers.h" 12 #include "net/http/http_request_headers.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitPlatformSupport .h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitPlatformSupport .h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h " 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderOptions.h "
18 #include "webkit/glue/multipart_response_delegate.h" 18 #include "webkit/glue/multipart_response_delegate.h"
19 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
20 20
21 using WebKit::WebFrame; 21 using WebKit::WebFrame;
22 using WebKit::WebString; 22 using WebKit::WebString;
23 using WebKit::WebURLError; 23 using WebKit::WebURLError;
24 using WebKit::WebURLLoader; 24 using WebKit::WebURLLoader;
25 using WebKit::WebURLLoaderOptions; 25 using WebKit::WebURLLoaderOptions;
26 using WebKit::WebURLRequest; 26 using WebKit::WebURLRequest;
27 using WebKit::WebURLResponse; 27 using WebKit::WebURLResponse;
28 using webkit_glue::MultipartResponseDelegate; 28 using webkit_glue::MultipartResponseDelegate;
29 29
30 namespace webkit_glue { 30 namespace webkit_media {
31 31
32 static const int kHttpOK = 200; 32 static const int kHttpOK = 200;
33 static const int kHttpPartialContent = 206; 33 static const int kHttpPartialContent = 206;
34 34
35 // Define the number of bytes in a megabyte. 35 // Define the number of bytes in a megabyte.
36 static const size_t kMegabyte = 1024 * 1024; 36 static const size_t kMegabyte = 1024 * 1024;
37 37
38 // Minimum capacity of the buffer in forward or backward direction. 38 // Minimum capacity of the buffer in forward or backward direction.
39 // 39 //
40 // 2MB is an arbitrary limit; it just seems to be "good enough" in practice. 40 // 2MB is an arbitrary limit; it just seems to be "good enough" in practice.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if (!start_callback_.get()) { 351 if (!start_callback_.get()) {
352 // Set the url in the request to an invalid value (empty url). 352 // Set the url in the request to an invalid value (empty url).
353 newRequest.setURL(WebKit::WebURL()); 353 newRequest.setURL(WebKit::WebURL());
354 return; 354 return;
355 } 355 }
356 356
357 // Only allow |single_origin_| if we haven't seen a different origin yet. 357 // Only allow |single_origin_| if we haven't seen a different origin yet.
358 if (single_origin_) 358 if (single_origin_)
359 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); 359 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin();
360 360
361 if (!IsProtocolSupportedForMedia(newRequest.url())) { 361 if (!webkit_glue::IsProtocolSupportedForMedia(newRequest.url())) {
362 // Set the url in the request to an invalid value (empty url). 362 // Set the url in the request to an invalid value (empty url).
363 newRequest.setURL(WebKit::WebURL()); 363 newRequest.setURL(WebKit::WebURL());
364 DoneStart(net::ERR_ADDRESS_INVALID); 364 DoneStart(net::ERR_ADDRESS_INVALID);
365 return; 365 return;
366 } 366 }
367 367
368 url_ = newRequest.url(); 368 url_ = newRequest.url();
369 } 369 }
370 370
371 void BufferedResourceLoader::didSendData( 371 void BufferedResourceLoader::didSendData(
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 void BufferedResourceLoader::Log() { 803 void BufferedResourceLoader::Log() {
804 if (buffer_.get()) { 804 if (buffer_.get()) {
805 media_log_->AddEvent( 805 media_log_->AddEvent(
806 media_log_->CreateBufferedExtentsChangedEvent( 806 media_log_->CreateBufferedExtentsChangedEvent(
807 offset_ - buffer_->backward_bytes(), 807 offset_ - buffer_->backward_bytes(),
808 offset_, 808 offset_,
809 offset_ + buffer_->forward_bytes())); 809 offset_ + buffer_->forward_bytes()));
810 } 810 }
811 } 811 }
812 812
813 } // namespace webkit_glue 813 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/buffered_resource_loader.h ('k') | webkit/media/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698