diff options
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 1 | ||||
-rw-r--r-- | chrome/renderer/render_process.cc | 4 | ||||
-rw-r--r-- | webkit/glue/media/buffered_data_source.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 5 |
5 files changed, 26 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 159a190..b0ec310 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -331,6 +331,7 @@ bool BrowserRenderProcessHost::Init() { switches::kEnableBenchmarking, switches::kInternalNaCl, switches::kEnableDatabases, + switches::kEnableByteRangeSupport, }; for (size_t i = 0; i < arraysize(switch_names); ++i) { diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc index 0c579ea..fbe38cf 100644 --- a/chrome/renderer/render_process.cc +++ b/chrome/renderer/render_process.cc @@ -85,6 +85,10 @@ RenderProcess::RenderProcess() if (command_line.HasSwitch(switches::kInternalNaCl)) RegisterInternalNaClPlugin(RenderProcess::LaunchNaClProcess); + if (command_line.HasSwitch(switches::kEnableByteRangeSupport)) { + webkit_glue::SetMediaCacheEnabled(true); + } + FilePath module_path; initialized_media_library_ = PathService::Get(base::DIR_MODULE, &module_path) && diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index 6efaa8c..63a3777 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -110,10 +110,12 @@ void BufferedResourceLoader::Start(net::CompletionCallback* start_callback) { // Creates the bridge on render thread since we can only access // ResourceDispatcher on this thread. - bridge_.reset(bridge_factory_->CreateBridge(url_, - net::LOAD_BYPASS_CACHE, - first_byte_position_, - last_byte_position_)); + bridge_.reset( + bridge_factory_->CreateBridge( + url_, + IsMediaCacheEnabled() ? net::LOAD_NORMAL : net::LOAD_BYPASS_CACHE, + first_byte_position_, + last_byte_position_)); // Increment the reference count right before we start the request. This // reference will be release when this request has ended. diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 92e62a3..77289d1 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -479,4 +479,14 @@ int GetGlyphPageCount() { return WebCore::GlyphPageTreeNode::treeGlyphPageCount(); } +bool g_enable_media_cache = false; + +bool IsMediaCacheEnabled() { + return g_enable_media_cache; +} + +void SetMediaCacheEnabled(bool enabled) { + g_enable_media_cache = enabled; +} + } // namespace webkit_glue diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 73fbe6b..1874510 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -122,6 +122,11 @@ WebKit::WebCanvas* ToWebCanvas(skia::PlatformCanvas*); // used to get memory usage statistics. int GetGlyphPageCount(); +// Methods to query and enable media cache. +// TODO(hclam): Remove these methods when the cache is stable enough. +bool IsMediaCacheEnabled(); +void SetMediaCacheEnabled(bool enabled); + //---- END FUNCTIONS IMPLEMENTED BY WEBKIT/GLUE ------------------------------- |