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

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

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_context_client.h" 5 #include "content/renderer/service_worker/service_worker_context_client.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "base/threading/thread_local.h" 16 #include "base/threading/thread_local.h"
16 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
(...skipping 21 matching lines...) Expand all
38 #include "content/public/renderer/document_state.h" 39 #include "content/public/renderer/document_state.h"
39 #include "content/renderer/background_sync/background_sync_client_impl.h" 40 #include "content/renderer/background_sync/background_sync_client_impl.h"
40 #include "content/renderer/devtools/devtools_agent.h" 41 #include "content/renderer/devtools/devtools_agent.h"
41 #include "content/renderer/render_thread_impl.h" 42 #include "content/renderer/render_thread_impl.h"
42 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" 43 #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
43 #include "content/renderer/service_worker/service_worker_type_util.h" 44 #include "content/renderer/service_worker/service_worker_type_util.h"
44 #include "ipc/ipc_message.h" 45 #include "ipc/ipc_message.h"
45 #include "ipc/ipc_message_macros.h" 46 #include "ipc/ipc_message_macros.h"
46 #include "third_party/WebKit/public/platform/URLConversion.h" 47 #include "third_party/WebKit/public/platform/URLConversion.h"
47 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 48 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
48 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h"
49 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 49 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
50 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 50 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
51 #include "third_party/WebKit/public/platform/WebString.h" 51 #include "third_party/WebKit/public/platform/WebString.h"
52 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi stration.h" 52 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi stration.h"
53 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onData.h" 53 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onData.h"
54 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerClientQueryOptions.h" 54 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerClientQueryOptions.h"
55 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerRequest.h" 55 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerRequest.h"
56 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerResponse.h" 56 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerResponse.h"
57 #include "third_party/WebKit/public/web/WebDataSource.h" 57 #include "third_party/WebKit/public/web/WebDataSource.h"
58 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h" 58 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 if (!callbacks) { 859 if (!callbacks) {
860 NOTREACHED() << "Got stray response: " << request_id; 860 NOTREACHED() << "Got stray response: " << request_id;
861 return; 861 return;
862 } 862 }
863 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; 863 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client;
864 if (!client.IsEmpty()) { 864 if (!client.IsEmpty()) {
865 DCHECK(client.IsValid()); 865 DCHECK(client.IsValid());
866 web_client.reset(new blink::WebServiceWorkerClientInfo( 866 web_client.reset(new blink::WebServiceWorkerClientInfo(
867 ToWebServiceWorkerClientInfo(client))); 867 ToWebServiceWorkerClientInfo(client)));
868 } 868 }
869 callbacks->onSuccess(blink::adoptWebPtr(web_client.release())); 869 callbacks->onSuccess(std::move(web_client));
870 context_->client_callbacks.Remove(request_id); 870 context_->client_callbacks.Remove(request_id);
871 } 871 }
872 872
873 void ServiceWorkerContextClient::OnDidGetClients( 873 void ServiceWorkerContextClient::OnDidGetClients(
874 int request_id, const std::vector<ServiceWorkerClientInfo>& clients) { 874 int request_id, const std::vector<ServiceWorkerClientInfo>& clients) {
875 TRACE_EVENT0("ServiceWorker", 875 TRACE_EVENT0("ServiceWorker",
876 "ServiceWorkerContextClient::OnDidGetClients"); 876 "ServiceWorkerContextClient::OnDidGetClients");
877 blink::WebServiceWorkerClientsCallbacks* callbacks = 877 blink::WebServiceWorkerClientsCallbacks* callbacks =
878 context_->clients_callbacks.Lookup(request_id); 878 context_->clients_callbacks.Lookup(request_id);
879 if (!callbacks) { 879 if (!callbacks) {
(...skipping 20 matching lines...) Expand all
900 if (!callbacks) { 900 if (!callbacks) {
901 NOTREACHED() << "Got stray response: " << request_id; 901 NOTREACHED() << "Got stray response: " << request_id;
902 return; 902 return;
903 } 903 }
904 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; 904 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client;
905 if (!client.IsEmpty()) { 905 if (!client.IsEmpty()) {
906 DCHECK(client.IsValid()); 906 DCHECK(client.IsValid());
907 web_client.reset(new blink::WebServiceWorkerClientInfo( 907 web_client.reset(new blink::WebServiceWorkerClientInfo(
908 ToWebServiceWorkerClientInfo(client))); 908 ToWebServiceWorkerClientInfo(client)));
909 } 909 }
910 callbacks->onSuccess(blink::adoptWebPtr(web_client.release())); 910 callbacks->onSuccess(std::move(web_client));
911 context_->client_callbacks.Remove(request_id); 911 context_->client_callbacks.Remove(request_id);
912 } 912 }
913 913
914 void ServiceWorkerContextClient::OnOpenWindowError( 914 void ServiceWorkerContextClient::OnOpenWindowError(
915 int request_id, 915 int request_id,
916 const std::string& message) { 916 const std::string& message) {
917 TRACE_EVENT0("ServiceWorker", 917 TRACE_EVENT0("ServiceWorker",
918 "ServiceWorkerContextClient::OnOpenWindowError"); 918 "ServiceWorkerContextClient::OnOpenWindowError");
919 blink::WebServiceWorkerClientCallbacks* callbacks = 919 blink::WebServiceWorkerClientCallbacks* callbacks =
920 context_->client_callbacks.Lookup(request_id); 920 context_->client_callbacks.Lookup(request_id);
(...skipping 15 matching lines...) Expand all
936 context_->client_callbacks.Lookup(request_id); 936 context_->client_callbacks.Lookup(request_id);
937 if (!callback) { 937 if (!callback) {
938 NOTREACHED() << "Got stray response: " << request_id; 938 NOTREACHED() << "Got stray response: " << request_id;
939 return; 939 return;
940 } 940 }
941 if (!client.IsEmpty()) { 941 if (!client.IsEmpty()) {
942 DCHECK(client.IsValid()); 942 DCHECK(client.IsValid());
943 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client ( 943 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client (
944 new blink::WebServiceWorkerClientInfo( 944 new blink::WebServiceWorkerClientInfo(
945 ToWebServiceWorkerClientInfo(client))); 945 ToWebServiceWorkerClientInfo(client)));
946 callback->onSuccess(blink::adoptWebPtr(web_client.release())); 946 callback->onSuccess(std::move(web_client));
947 } else { 947 } else {
948 callback->onError(blink::WebServiceWorkerError( 948 callback->onError(blink::WebServiceWorkerError(
949 blink::WebServiceWorkerError::ErrorTypeNotFound, 949 blink::WebServiceWorkerError::ErrorTypeNotFound,
950 "The WindowClient was not found.")); 950 "The WindowClient was not found."));
951 } 951 }
952 952
953 context_->client_callbacks.Remove(request_id); 953 context_->client_callbacks.Remove(request_id);
954 } 954 }
955 955
956 void ServiceWorkerContextClient::OnNavigateClientResponse( 956 void ServiceWorkerContextClient::OnNavigateClientResponse(
957 int request_id, 957 int request_id,
958 const ServiceWorkerClientInfo& client) { 958 const ServiceWorkerClientInfo& client) {
959 TRACE_EVENT0("ServiceWorker", 959 TRACE_EVENT0("ServiceWorker",
960 "ServiceWorkerContextClient::OnNavigateClientResponse"); 960 "ServiceWorkerContextClient::OnNavigateClientResponse");
961 blink::WebServiceWorkerClientCallbacks* callbacks = 961 blink::WebServiceWorkerClientCallbacks* callbacks =
962 context_->client_callbacks.Lookup(request_id); 962 context_->client_callbacks.Lookup(request_id);
963 if (!callbacks) { 963 if (!callbacks) {
964 NOTREACHED() << "Got stray response: " << request_id; 964 NOTREACHED() << "Got stray response: " << request_id;
965 return; 965 return;
966 } 966 }
967 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; 967 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client;
968 if (!client.IsEmpty()) { 968 if (!client.IsEmpty()) {
969 DCHECK(client.IsValid()); 969 DCHECK(client.IsValid());
970 web_client.reset(new blink::WebServiceWorkerClientInfo( 970 web_client.reset(new blink::WebServiceWorkerClientInfo(
971 ToWebServiceWorkerClientInfo(client))); 971 ToWebServiceWorkerClientInfo(client)));
972 } 972 }
973 callbacks->onSuccess(blink::adoptWebPtr(web_client.release())); 973 callbacks->onSuccess(std::move(web_client));
974 context_->client_callbacks.Remove(request_id); 974 context_->client_callbacks.Remove(request_id);
975 } 975 }
976 976
977 void ServiceWorkerContextClient::OnNavigateClientError(int request_id, 977 void ServiceWorkerContextClient::OnNavigateClientError(int request_id,
978 const GURL& url) { 978 const GURL& url) {
979 TRACE_EVENT0("ServiceWorker", 979 TRACE_EVENT0("ServiceWorker",
980 "ServiceWorkerContextClient::OnNavigateClientError"); 980 "ServiceWorkerContextClient::OnNavigateClientError");
981 blink::WebServiceWorkerClientCallbacks* callbacks = 981 blink::WebServiceWorkerClientCallbacks* callbacks =
982 context_->client_callbacks.Lookup(request_id); 982 context_->client_callbacks.Lookup(request_id);
983 if (!callbacks) { 983 if (!callbacks) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 } 1038 }
1039 1039
1040 base::WeakPtr<ServiceWorkerContextClient> 1040 base::WeakPtr<ServiceWorkerContextClient>
1041 ServiceWorkerContextClient::GetWeakPtr() { 1041 ServiceWorkerContextClient::GetWeakPtr() {
1042 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 1042 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
1043 DCHECK(context_); 1043 DCHECK(context_);
1044 return context_->weak_factory.GetWeakPtr(); 1044 return context_->weak_factory.GetWeakPtr();
1045 } 1045 }
1046 1046
1047 } // namespace content 1047 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/push_messaging/push_messaging_dispatcher.cc ('k') | content/renderer/usb/web_usb_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698