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

Side by Side Diff: content/renderer/mojo/service_registry_js_wrapper.h

Issue 1827473002: Make the process-wide ServiceRegistry available to JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 #ifndef CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_ 5 #ifndef CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_
6 #define CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_ 6 #define CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 23 matching lines...) Expand all
34 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( 34 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
35 v8::Isolate* isolate) override; 35 v8::Isolate* isolate) override;
36 36
37 // JS interface implementation. 37 // JS interface implementation.
38 void AddServiceOverrideForTesting(const std::string& service_name, 38 void AddServiceOverrideForTesting(const std::string& service_name,
39 v8::Local<v8::Function> service_factory); 39 v8::Local<v8::Function> service_factory);
40 void ClearServiceOverridesForTesting(); 40 void ClearServiceOverridesForTesting();
41 mojo::Handle ConnectToService(const std::string& service_name); 41 mojo::Handle ConnectToService(const std::string& service_name);
42 42
43 static gin::WrapperInfo kWrapperInfo; 43 static gin::WrapperInfo kWrapperInfo;
44 static const char kModuleName[]; 44 static const char kPerFrameModuleName[];
45 static const char kPerProcessModuleName[];
45 46
46 private: 47 private:
47 using ScopedJsFactory = 48 using ScopedJsFactory =
48 v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function>>; 49 v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function>>;
49 50
50 ServiceRegistryJsWrapper(v8::Isolate* isolate, 51 ServiceRegistryJsWrapper(v8::Isolate* isolate,
51 v8::Handle<v8::Context> context, 52 v8::Handle<v8::Context> context,
52 base::WeakPtr<ServiceRegistry> service_registry); 53 base::WeakPtr<ServiceRegistry> service_registry);
53 54
54 void CallJsFactory(const ScopedJsFactory& factory, 55 void CallJsFactory(const ScopedJsFactory& factory,
55 mojo::ScopedMessagePipeHandle pipe); 56 mojo::ScopedMessagePipeHandle pipe);
56 57
57 static void ClearContext( 58 static void ClearContext(
58 const v8::WeakCallbackInfo<ServiceRegistryJsWrapper>& data); 59 const v8::WeakCallbackInfo<ServiceRegistryJsWrapper>& data);
59 60
60 v8::Isolate* isolate_; 61 v8::Isolate* isolate_;
61 v8::Global<v8::Context> context_; 62 v8::Global<v8::Context> context_;
62 base::WeakPtr<ServiceRegistry> service_registry_; 63 base::WeakPtr<ServiceRegistry> service_registry_;
63 64
64 base::WeakPtrFactory<ServiceRegistryJsWrapper> weak_factory_; 65 base::WeakPtrFactory<ServiceRegistryJsWrapper> weak_factory_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryJsWrapper); 67 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryJsWrapper);
67 }; 68 };
68 69
69 } // namespace content 70 } // namespace content
70 71
71 #endif // CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_ 72 #endif // CONTENT_RENDERER_MOJO_SERVICE_REGISTRY_JS_WRAPPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/plugins.js ('k') | content/renderer/mojo/service_registry_js_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698