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

Side by Side Diff: extensions/renderer/request_sender.cc

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync@tott Created 4 years, 2 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 | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/service_worker_data.h » ('j') | 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 "extensions/renderer/request_sender.h" 5 #include "extensions/renderer/request_sender.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/timer/elapsed_timer.h" 8 #include "base/timer/elapsed_timer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
11 #include "extensions/common/constants.h"
11 #include "extensions/common/extension_messages.h" 12 #include "extensions/common/extension_messages.h"
12 #include "extensions/renderer/script_context.h" 13 #include "extensions/renderer/script_context.h"
13 #include "third_party/WebKit/public/web/WebDocument.h" 14 #include "third_party/WebKit/public/web/WebDocument.h"
14 #include "third_party/WebKit/public/web/WebLocalFrame.h" 15 #include "third_party/WebKit/public/web/WebLocalFrame.h"
15 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 16 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
16 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 17 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
17 #include "third_party/WebKit/public/web/WebUserGestureToken.h" 18 #include "third_party/WebKit/public/web/WebUserGestureToken.h"
18 19
19 namespace extensions { 20 namespace extensions {
20 21
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 params.extension_id = context->GetExtensionID(); 112 params.extension_id = context->GetExtensionID();
112 params.source_url = source_url; 113 params.source_url = source_url;
113 params.source_tab_id = source_tab_id_; 114 params.source_tab_id = source_tab_id_;
114 params.request_id = request_id; 115 params.request_id = request_id;
115 params.has_callback = has_callback; 116 params.has_callback = has_callback;
116 params.user_gesture = 117 params.user_gesture =
117 blink::WebUserGestureIndicator::isProcessingUserGesture(); 118 blink::WebUserGestureIndicator::isProcessingUserGesture();
118 119
119 // Set Service Worker specific params to default values. 120 // Set Service Worker specific params to default values.
120 params.worker_thread_id = -1; 121 params.worker_thread_id = -1;
121 params.embedded_worker_id = -1; 122 params.service_worker_version_id = kInvalidServiceWorkerVersionId;
122 123
123 SendRequest(render_frame, for_io_thread, params); 124 SendRequest(render_frame, for_io_thread, params);
124 return true; 125 return true;
125 } 126 }
126 127
127 void RequestSender::SendRequest(content::RenderFrame* render_frame, 128 void RequestSender::SendRequest(content::RenderFrame* render_frame,
128 bool for_io_thread, 129 bool for_io_thread,
129 ExtensionHostMsg_Request_Params& params) { 130 ExtensionHostMsg_Request_Params& params) {
130 if (for_io_thread) { 131 if (for_io_thread) {
131 render_frame->Send(new ExtensionHostMsg_RequestForIOThread( 132 render_frame->Send(new ExtensionHostMsg_RequestForIOThread(
(...skipping 29 matching lines...) Expand all
161 for (PendingRequestMap::iterator it = pending_requests_.begin(); 162 for (PendingRequestMap::iterator it = pending_requests_.begin();
162 it != pending_requests_.end();) { 163 it != pending_requests_.end();) {
163 if (it->second->source == source) 164 if (it->second->source == source)
164 pending_requests_.erase(it++); 165 pending_requests_.erase(it++);
165 else 166 else
166 ++it; 167 ++it;
167 } 168 }
168 } 169 }
169 170
170 } // namespace extensions 171 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/service_worker_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698