| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/service_worker/embedded_worker_dispatcher.h" | 5 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 start_data.scriptURL = params.script_url; | 86 start_data.scriptURL = params.script_url; |
| 87 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent()); | 87 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent()); |
| 88 start_data.pauseAfterDownloadMode = | 88 start_data.pauseAfterDownloadMode = |
| 89 params.pause_after_download ? | 89 params.pause_after_download ? |
| 90 blink::WebEmbeddedWorkerStartData::PauseAfterDownload : | 90 blink::WebEmbeddedWorkerStartData::PauseAfterDownload : |
| 91 blink::WebEmbeddedWorkerStartData::DontPauseAfterDownload; | 91 blink::WebEmbeddedWorkerStartData::DontPauseAfterDownload; |
| 92 start_data.waitForDebuggerMode = | 92 start_data.waitForDebuggerMode = |
| 93 params.wait_for_debugger ? | 93 params.wait_for_debugger ? |
| 94 blink::WebEmbeddedWorkerStartData::WaitForDebugger : | 94 blink::WebEmbeddedWorkerStartData::WaitForDebugger : |
| 95 blink::WebEmbeddedWorkerStartData::DontWaitForDebugger; | 95 blink::WebEmbeddedWorkerStartData::DontWaitForDebugger; |
| 96 |
| 97 // This change has both Chrome + blink components. The #if-guard allows us |
| 98 // to do this in two steps. |
| 99 #ifdef CLEANUP_V8_CACHE_OPTIONS_GUARD |
| 100 // Proper solution: |
| 96 start_data.v8CacheOptions = | 101 start_data.v8CacheOptions = |
| 97 static_cast<blink::WebSettings::V8CacheOptions>(params.v8_cache_options); | 102 static_cast<blink::WebSettings::V8CacheOptions>(params.v8_cache_options); |
| 103 #else |
| 104 // Temporary solution, while not all changes are in: |
| 105 switch (params.v8_cache_options) { |
| 106 case V8_CACHE_OPTIONS_DEFAULT: |
| 107 start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsDefault; |
| 108 break; |
| 109 case V8_CACHE_OPTIONS_NONE: |
| 110 start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsNone; |
| 111 break; |
| 112 case V8_CACHE_OPTIONS_PARSE: |
| 113 start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsParseMemory; |
| 114 break; |
| 115 case V8_CACHE_OPTIONS_CODE: |
| 116 start_data.v8CacheOptions = blink::WebSettings::V8CacheOptionsHeuristics; |
| 117 break; |
| 118 } |
| 119 #endif // CLEANUP_V8_CACHE_OPTIONS_GUARD |
| 98 | 120 |
| 99 wrapper->worker()->startWorkerContext(start_data); | 121 wrapper->worker()->startWorkerContext(start_data); |
| 100 workers_.AddWithID(wrapper.release(), params.embedded_worker_id); | 122 workers_.AddWithID(wrapper.release(), params.embedded_worker_id); |
| 101 } | 123 } |
| 102 | 124 |
| 103 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) { | 125 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) { |
| 104 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStopWorker"); | 126 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStopWorker"); |
| 105 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); | 127 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); |
| 106 if (!wrapper) { | 128 if (!wrapper) { |
| 107 LOG(WARNING) << "Got OnStopWorker for nonexistent worker"; | 129 LOG(WARNING) << "Got OnStopWorker for nonexistent worker"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 119 "EmbeddedWorkerDispatcher::OnResumeAfterDownload"); | 141 "EmbeddedWorkerDispatcher::OnResumeAfterDownload"); |
| 120 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); | 142 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); |
| 121 if (!wrapper) { | 143 if (!wrapper) { |
| 122 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker"; | 144 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker"; |
| 123 return; | 145 return; |
| 124 } | 146 } |
| 125 wrapper->worker()->resumeAfterDownload(); | 147 wrapper->worker()->resumeAfterDownload(); |
| 126 } | 148 } |
| 127 | 149 |
| 128 } // namespace content | 150 } // namespace content |
| OLD | NEW |