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

Side by Side Diff: content/renderer/mojo_context_state.cc

Issue 2676443005: Add interface versioning. Methods queryVersion and requireVersion. (Closed)
Patch Set: Expect the result inside the error handler for test. Code formatting and address codereview comment… Created 3 years, 10 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 | « content/content_resources.grd ('k') | extensions/renderer/dispatcher.cc » ('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 "content/renderer/mojo_context_state.h" 5 #include "content/renderer/mojo_context_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 std::map<std::string, scoped_refptr<base::RefCountedMemory>>; 54 std::map<std::string, scoped_refptr<base::RefCountedMemory>>;
55 55
56 base::LazyInstance<std::unique_ptr<ModuleSourceMap>>::Leaky g_module_sources; 56 base::LazyInstance<std::unique_ptr<ModuleSourceMap>>::Leaky g_module_sources;
57 57
58 scoped_refptr<base::RefCountedMemory> GetBuiltinModuleData( 58 scoped_refptr<base::RefCountedMemory> GetBuiltinModuleData(
59 const std::string& path) { 59 const std::string& path) {
60 static const struct { 60 static const struct {
61 const char* path; 61 const char* path;
62 const int id; 62 const int id;
63 } kBuiltinModuleResources[] = { 63 } kBuiltinModuleResources[] = {
64 { mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS }, 64 {mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS},
65 { mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS }, 65 {mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS},
66 { mojo::kCodecModuleName, IDR_MOJO_CODEC_JS }, 66 {mojo::kCodecModuleName, IDR_MOJO_CODEC_JS},
67 { mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS }, 67 {mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS},
68 { mojo::kInterfaceTypesModuleName, IDR_MOJO_INTERFACE_TYPES_JS }, 68 {mojo::kControlMessageHandlerModuleName,
69 { mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS }, 69 IDR_MOJO_CONTROL_MESSAGE_HANDLER_JS},
70 { mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS }, 70 {mojo::kControlMessageProxyModuleName, IDR_MOJO_CONTROL_MESSAGE_PROXY_JS},
71 { mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS }, 71 {mojo::kInterfaceControlMessagesMojom,
72 IDR_MOJO_INTERFACE_CONTROL_MESSAGES_MOJOM_JS},
73 {mojo::kInterfaceTypesModuleName, IDR_MOJO_INTERFACE_TYPES_JS},
74 {mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS},
75 {mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS},
76 {mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS},
72 }; 77 };
73 78
74 std::unique_ptr<ModuleSourceMap>& module_sources = g_module_sources.Get(); 79 std::unique_ptr<ModuleSourceMap>& module_sources = g_module_sources.Get();
75 if (!module_sources) { 80 if (!module_sources) {
76 // Initialize the module source map on first access. 81 // Initialize the module source map on first access.
77 module_sources.reset(new ModuleSourceMap); 82 module_sources.reset(new ModuleSourceMap);
78 for (size_t i = 0; i < arraysize(kBuiltinModuleResources); ++i) { 83 for (size_t i = 0; i < arraysize(kBuiltinModuleResources); ++i) {
79 const auto& resource = kBuiltinModuleResources[i]; 84 const auto& resource = kBuiltinModuleResources[i];
80 scoped_refptr<base::RefCountedMemory> data = 85 scoped_refptr<base::RefCountedMemory> data =
81 GetContentClient()->GetDataResourceBytes(resource.id); 86 GetContentClient()->GetDataResourceBytes(resource.id);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const std::vector<std::string>& dependencies) { 218 const std::vector<std::string>& dependencies) {
214 FetchModules(dependencies); 219 FetchModules(dependencies);
215 220
216 gin::ContextHolder* context_holder = runner_->GetContextHolder(); 221 gin::ContextHolder* context_holder = runner_->GetContextHolder();
217 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( 222 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(
218 context_holder->context()); 223 context_holder->context());
219 registry->AttemptToLoadMoreModules(context_holder->isolate()); 224 registry->AttemptToLoadMoreModules(context_holder->isolate());
220 } 225 }
221 226
222 } // namespace content 227 } // namespace content
OLDNEW
« no previous file with comments | « content/content_resources.grd ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698