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

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 931173002: Implement EmbeddedWorkerContextClient.setCachedMetadata/clearCachedMetadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix clang failure Created 5 years, 10 months 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
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/renderer/service_worker/service_worker_script_context.h" 5 #include "content/renderer/service_worker/service_worker_script_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/child/notifications/notification_data_conversions.h" 10 #include "content/child/notifications/notification_data_conversions.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 GetRoutingID(), request_id)); 226 GetRoutingID(), request_id));
227 } 227 }
228 228
229 void ServiceWorkerScriptContext::OpenWindow( 229 void ServiceWorkerScriptContext::OpenWindow(
230 const GURL& url, blink::WebServiceWorkerClientCallbacks* callbacks) { 230 const GURL& url, blink::WebServiceWorkerClientCallbacks* callbacks) {
231 DCHECK(callbacks); 231 DCHECK(callbacks);
232 int request_id = pending_client_callbacks_.Add(callbacks); 232 int request_id = pending_client_callbacks_.Add(callbacks);
233 Send(new ServiceWorkerHostMsg_OpenWindow(GetRoutingID(), request_id, url)); 233 Send(new ServiceWorkerHostMsg_OpenWindow(GetRoutingID(), request_id, url));
234 } 234 }
235 235
236 void ServiceWorkerScriptContext::SetCachedMetadata(const GURL& url,
237 const char* data,
238 size_t size) {
239 std::vector<char> copy(data, data + size);
240 Send(new ServiceWorkerHostMsg_SetCachedMetadata(GetRoutingID(), url, copy));
241 }
242
243 void ServiceWorkerScriptContext::ClearCachedMetadata(const GURL& url) {
244 Send(new ServiceWorkerHostMsg_ClearCachedMetadata(GetRoutingID(), url));
245 }
246
236 void ServiceWorkerScriptContext::PostMessageToDocument( 247 void ServiceWorkerScriptContext::PostMessageToDocument(
237 int client_id, 248 int client_id,
238 const base::string16& message, 249 const base::string16& message,
239 scoped_ptr<blink::WebMessagePortChannelArray> channels) { 250 scoped_ptr<blink::WebMessagePortChannelArray> channels) {
240 // This may send channels for MessagePorts, and all internal book-keeping 251 // This may send channels for MessagePorts, and all internal book-keeping
241 // messages for MessagePort (e.g. QueueMessages) are sent from main thread 252 // messages for MessagePort (e.g. QueueMessages) are sent from main thread
242 // (with thread hopping), so we need to do the same thread hopping here not 253 // (with thread hopping), so we need to do the same thread hopping here not
243 // to overtake those messages. 254 // to overtake those messages.
244 embedded_context_->main_thread_proxy()->PostTask( 255 embedded_context_->main_thread_proxy()->PostTask(
245 FROM_HERE, 256 FROM_HERE,
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 NOTREACHED() << "Got stray response: " << request_id; 576 NOTREACHED() << "Got stray response: " << request_id;
566 return; 577 return;
567 } 578 }
568 scoped_ptr<blink::WebServiceWorkerError> error( 579 scoped_ptr<blink::WebServiceWorkerError> error(
569 new blink::WebServiceWorkerError(error_type, message)); 580 new blink::WebServiceWorkerError(error_type, message));
570 callbacks->onError(error.release()); 581 callbacks->onError(error.release());
571 pending_claim_clients_callbacks_.Remove(request_id); 582 pending_claim_clients_callbacks_.Remove(request_id);
572 } 583 }
573 584
574 } // namespace content 585 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698