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

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 2106693002: Convert EmbeddedWorker to InterfaceRegistry/Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 14 matching lines...) Expand all
25 #include "base/observer_list.h" 25 #include "base/observer_list.h"
26 #include "base/threading/thread_task_runner_handle.h" 26 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/timer/timer.h" 27 #include "base/timer/timer.h"
28 #include "content/browser/service_worker/embedded_worker_instance.h" 28 #include "content/browser/service_worker/embedded_worker_instance.h"
29 #include "content/browser/service_worker/embedded_worker_status.h" 29 #include "content/browser/service_worker/embedded_worker_status.h"
30 #include "content/browser/service_worker/service_worker_metrics.h" 30 #include "content/browser/service_worker/service_worker_metrics.h"
31 #include "content/browser/service_worker/service_worker_script_cache_map.h" 31 #include "content/browser/service_worker/service_worker_script_cache_map.h"
32 #include "content/common/content_export.h" 32 #include "content/common/content_export.h"
33 #include "content/common/service_worker/service_worker_status_code.h" 33 #include "content/common/service_worker/service_worker_status_code.h"
34 #include "content/common/service_worker/service_worker_types.h" 34 #include "content/common/service_worker/service_worker_types.h"
35 #include "content/public/common/service_registry.h"
36 #include "ipc/ipc_message.h" 35 #include "ipc/ipc_message.h"
36 #include "services/shell/public/cpp/interface_provider.h"
37 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h" 37 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h"
38 #include "url/gurl.h" 38 #include "url/gurl.h"
39 #include "url/origin.h" 39 #include "url/origin.h"
40 40
41 // Windows headers will redefine SendMessage. 41 // Windows headers will redefine SendMessage.
42 #ifdef SendMessage 42 #ifdef SendMessage
43 #undef SendMessage 43 #undef SendMessage
44 #endif 44 #endif
45 45
46 namespace net { 46 namespace net {
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 PendingRequest<StatusCallback>* request = custom_requests_.Lookup(request_id); 687 PendingRequest<StatusCallback>* request = custom_requests_.Lookup(request_id);
688 DCHECK(request) << "Invalid request id"; 688 DCHECK(request) << "Invalid request id";
689 DCHECK(!request->mojo_service) 689 DCHECK(!request->mojo_service)
690 << "Request is already associated with a mojo service"; 690 << "Request is already associated with a mojo service";
691 691
692 MojoServiceWrapper<Interface>* service = 692 MojoServiceWrapper<Interface>* service =
693 static_cast<MojoServiceWrapper<Interface>*>( 693 static_cast<MojoServiceWrapper<Interface>*>(
694 mojo_services_.get(Interface::Name_)); 694 mojo_services_.get(Interface::Name_));
695 if (!service) { 695 if (!service) {
696 mojo::InterfacePtr<Interface> interface; 696 mojo::InterfacePtr<Interface> interface;
697 embedded_worker_->GetServiceRegistry()->ConnectToRemoteService( 697 embedded_worker_->GetRemoteInterfaces()->GetInterface(&interface);
698 mojo::GetProxy(&interface));
699 interface.set_connection_error_handler( 698 interface.set_connection_error_handler(
700 base::Bind(&ServiceWorkerVersion::OnMojoConnectionError, 699 base::Bind(&ServiceWorkerVersion::OnMojoConnectionError,
701 weak_factory_.GetWeakPtr(), Interface::Name_)); 700 weak_factory_.GetWeakPtr(), Interface::Name_));
702 service = new MojoServiceWrapper<Interface>(this, std::move(interface)); 701 service = new MojoServiceWrapper<Interface>(this, std::move(interface));
703 mojo_services_.add(Interface::Name_, base::WrapUnique(service)); 702 mojo_services_.add(Interface::Name_, base::WrapUnique(service));
704 } 703 }
705 request->mojo_service = Interface::Name_; 704 request->mojo_service = Interface::Name_;
706 return service->GetWeakPtr(); 705 return service->GetWeakPtr();
707 } 706 }
708 707
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 753
755 // At this point |this| can have been deleted, so don't do anything other 754 // At this point |this| can have been deleted, so don't do anything other
756 // than returning. 755 // than returning.
757 756
758 return true; 757 return true;
759 } 758 }
760 759
761 } // namespace content 760 } // namespace content
762 761
763 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 762 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698