| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 request, network_delegate, headers, body_, true); | 220 request, network_delegate, headers, body_, true); |
| 221 } | 221 } |
| 222 | 222 |
| 223 private: | 223 private: |
| 224 std::string body_; | 224 std::string body_; |
| 225 DISALLOW_COPY_AND_ASSIGN(LongLivedResourceInterceptor); | 225 DISALLOW_COPY_AND_ASSIGN(LongLivedResourceInterceptor); |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 void CreateLongLivedResourceInterceptors( | 228 void CreateLongLivedResourceInterceptors( |
| 229 const GURL& worker_url, const GURL& import_url) { | 229 const GURL& worker_url, const GURL& import_url) { |
| 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 230 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 231 scoped_ptr<net::URLRequestInterceptor> interceptor; | 231 scoped_ptr<net::URLRequestInterceptor> interceptor; |
| 232 | 232 |
| 233 interceptor.reset(new LongLivedResourceInterceptor( | 233 interceptor.reset(new LongLivedResourceInterceptor( |
| 234 "importScripts('long_lived_import.js');")); | 234 "importScripts('long_lived_import.js');")); |
| 235 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( | 235 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( |
| 236 worker_url, interceptor.Pass()); | 236 worker_url, interceptor.Pass()); |
| 237 | 237 |
| 238 interceptor.reset(new LongLivedResourceInterceptor( | 238 interceptor.reset(new LongLivedResourceInterceptor( |
| 239 "// the imported script does nothing")); | 239 "// the imported script does nothing")); |
| 240 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( | 240 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 ASSERT_EQ(SERVICE_WORKER_OK, status); | 1198 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 1199 // Stop the worker. | 1199 // Stop the worker. |
| 1200 StopWorker(SERVICE_WORKER_OK); | 1200 StopWorker(SERVICE_WORKER_OK); |
| 1201 // Restart the worker. | 1201 // Restart the worker. |
| 1202 StartWorker(SERVICE_WORKER_OK); | 1202 StartWorker(SERVICE_WORKER_OK); |
| 1203 // Stop the worker. | 1203 // Stop the worker. |
| 1204 StopWorker(SERVICE_WORKER_OK); | 1204 StopWorker(SERVICE_WORKER_OK); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 } // namespace content | 1207 } // namespace content |
| OLD | NEW |