| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/common/extensions/url_pattern.h" | 10 #include "chrome/common/extensions/url_pattern.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 if (first_byte_position_ != kPositionNotSpecified) { | 103 if (first_byte_position_ != kPositionNotSpecified) { |
| 104 range_requested_ = true; | 104 range_requested_ = true; |
| 105 // TODO(hclam): server may not support range request so |offset_| may not | 105 // TODO(hclam): server may not support range request so |offset_| may not |
| 106 // equal to |first_byte_position_|. | 106 // equal to |first_byte_position_|. |
| 107 offset_ = first_byte_position_; | 107 offset_ = first_byte_position_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Creates the bridge on render thread since we can only access | 110 // Creates the bridge on render thread since we can only access |
| 111 // ResourceDispatcher on this thread. | 111 // ResourceDispatcher on this thread. |
| 112 bridge_.reset(bridge_factory_->CreateBridge(url_, | 112 bridge_.reset( |
| 113 net::LOAD_BYPASS_CACHE, | 113 bridge_factory_->CreateBridge( |
| 114 first_byte_position_, | 114 url_, |
| 115 last_byte_position_)); | 115 IsMediaCacheEnabled() ? net::LOAD_NORMAL : net::LOAD_BYPASS_CACHE, |
| 116 first_byte_position_, |
| 117 last_byte_position_)); |
| 116 | 118 |
| 117 // Increment the reference count right before we start the request. This | 119 // Increment the reference count right before we start the request. This |
| 118 // reference will be release when this request has ended. | 120 // reference will be release when this request has ended. |
| 119 AddRef(); | 121 AddRef(); |
| 120 | 122 |
| 121 // And start the resource loading. | 123 // And start the resource loading. |
| 122 bridge_->Start(this); | 124 bridge_->Start(this); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void BufferedResourceLoader::Stop() { | 127 void BufferedResourceLoader::Stop() { |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 render_loop_->PostTask(FROM_HERE, | 852 render_loop_->PostTask(FROM_HERE, |
| 851 NewRunnableMethod(this, &BufferedDataSource::SwapLoaderTask, | 853 NewRunnableMethod(this, &BufferedDataSource::SwapLoaderTask, |
| 852 CreateLoader(read_position_, -1))); | 854 CreateLoader(read_position_, -1))); |
| 853 } else { | 855 } else { |
| 854 loader_->Stop(); | 856 loader_->Stop(); |
| 855 DoneRead(error); | 857 DoneRead(error); |
| 856 } | 858 } |
| 857 } | 859 } |
| 858 | 860 |
| 859 } // namespace webkit_glue | 861 } // namespace webkit_glue |
| OLD | NEW |