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

Side by Side Diff: content/browser/service_worker/service_worker_request_handler.cc

Issue 475333002: [ServiceWorker] Sends the blob uuid of the request body to the ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve blobs Created 6 years, 4 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
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/browser/service_worker/service_worker_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
11 #include "content/browser/service_worker/service_worker_provider_host.h" 11 #include "content/browser/service_worker/service_worker_provider_host.h"
12 #include "content/browser/service_worker/service_worker_registration.h" 12 #include "content/browser/service_worker/service_worker_registration.h"
13 #include "content/browser/service_worker/service_worker_url_request_job.h" 13 #include "content/browser/service_worker/service_worker_url_request_job.h"
14 #include "content/browser/service_worker/service_worker_utils.h" 14 #include "content/browser/service_worker/service_worker_utils.h"
15 #include "content/common/resource_request_body.h"
15 #include "content/common/service_worker/service_worker_types.h" 16 #include "content/common/service_worker/service_worker_types.h"
16 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_interceptor.h" 18 #include "net/url_request/url_request_interceptor.h"
18 #include "webkit/browser/blob/blob_storage_context.h" 19 #include "webkit/browser/blob/blob_storage_context.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 namespace { 23 namespace {
23 24
24 int kUserDataKey; // Key value is not important. 25 int kUserDataKey; // Key value is not important.
(...skipping 18 matching lines...) Expand all
43 }; 44 };
44 45
45 } // namespace 46 } // namespace
46 47
47 void ServiceWorkerRequestHandler::InitializeHandler( 48 void ServiceWorkerRequestHandler::InitializeHandler(
48 net::URLRequest* request, 49 net::URLRequest* request,
49 ServiceWorkerContextWrapper* context_wrapper, 50 ServiceWorkerContextWrapper* context_wrapper,
50 webkit_blob::BlobStorageContext* blob_storage_context, 51 webkit_blob::BlobStorageContext* blob_storage_context,
51 int process_id, 52 int process_id,
52 int provider_id, 53 int provider_id,
53 ResourceType resource_type) { 54 ResourceType resource_type,
55 scoped_refptr<ResourceRequestBody> body) {
54 if (!request->url().SchemeIsHTTPOrHTTPS()) 56 if (!request->url().SchemeIsHTTPOrHTTPS())
55 return; 57 return;
56 58
57 if (!context_wrapper || !context_wrapper->context() || 59 if (!context_wrapper || !context_wrapper->context() ||
58 provider_id == kInvalidServiceWorkerProviderId) { 60 provider_id == kInvalidServiceWorkerProviderId) {
59 return; 61 return;
60 } 62 }
61 63
62 ServiceWorkerProviderHost* provider_host = 64 ServiceWorkerProviderHost* provider_host =
63 context_wrapper->context()->GetProviderHost(process_id, provider_id); 65 context_wrapper->context()->GetProviderHost(process_id, provider_id);
64 if (!provider_host || !provider_host->IsContextAlive()) 66 if (!provider_host || !provider_host->IsContextAlive())
65 return; 67 return;
66 68
67 scoped_ptr<ServiceWorkerRequestHandler> handler( 69 scoped_ptr<ServiceWorkerRequestHandler> handler(
68 provider_host->CreateRequestHandler(resource_type, 70 provider_host->CreateRequestHandler(
69 blob_storage_context->AsWeakPtr())); 71 resource_type, blob_storage_context->AsWeakPtr(), body));
70 if (!handler) 72 if (!handler)
71 return; 73 return;
72 74
73 request->SetUserData(&kUserDataKey, handler.release()); 75 request->SetUserData(&kUserDataKey, handler.release());
74 } 76 }
75 77
76 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler( 78 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler(
77 net::URLRequest* request) { 79 net::URLRequest* request) {
78 return reinterpret_cast<ServiceWorkerRequestHandler*>( 80 return reinterpret_cast<ServiceWorkerRequestHandler*>(
79 request->GetUserData(&kUserDataKey)); 81 request->GetUserData(&kUserDataKey));
(...skipping 13 matching lines...) Expand all
93 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 95 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
94 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, 96 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
95 ResourceType resource_type) 97 ResourceType resource_type)
96 : context_(context), 98 : context_(context),
97 provider_host_(provider_host), 99 provider_host_(provider_host),
98 blob_storage_context_(blob_storage_context), 100 blob_storage_context_(blob_storage_context),
99 resource_type_(resource_type) { 101 resource_type_(resource_type) {
100 } 102 }
101 103
102 } // namespace content 104 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698