| Index: extensions/renderer/api_type_reference_map.cc
|
| diff --git a/extensions/renderer/api_type_reference_map.cc b/extensions/renderer/api_type_reference_map.cc
|
| index d700e34bcbf8ba6b93636bab3e79e61de5f10dd3..328cf28099fe7f5aa985ebd6461cc8b54aaa73c9 100644
|
| --- a/extensions/renderer/api_type_reference_map.cc
|
| +++ b/extensions/renderer/api_type_reference_map.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "extensions/renderer/api_type_reference_map.h"
|
|
|
| +#include "extensions/renderer/api_signature.h"
|
| #include "extensions/renderer/argument_spec.h"
|
|
|
| namespace extensions {
|
| @@ -29,4 +30,27 @@ const ArgumentSpec* APITypeReferenceMap::GetSpec(
|
| return iter == type_refs_.end() ? nullptr : iter->second.get();
|
| }
|
|
|
| +void APITypeReferenceMap::AddTypeMethodSignature(
|
| + const std::string& name,
|
| + std::unique_ptr<APISignature> signature) {
|
| + DCHECK(type_methods_.find(name) == type_methods_.end())
|
| + << "Cannot re-register signature for: " << name;
|
| + type_methods_[name] = std::move(signature);
|
| +}
|
| +
|
| +const APISignature* APITypeReferenceMap::GetTypeMethodSignature(
|
| + const std::string& name) const {
|
| + auto iter = type_methods_.find(name);
|
| + if (iter == type_methods_.end()) {
|
| + // Find the type name by stripping away the method suffix.
|
| + std::string::size_type dot = name.rfind('.');
|
| + DCHECK_NE(std::string::npos, dot);
|
| + DCHECK_LT(dot, name.size() - 1);
|
| + std::string type_name = name.substr(0, dot);
|
| + initialize_type_.Run(type_name);
|
| + iter = type_methods_.find(name);
|
| + }
|
| + return iter == type_methods_.end() ? nullptr : iter->second.get();
|
| +}
|
| +
|
| } // namespace extensions
|
|
|