Commit 499b4956 authored by Mark Brand's avatar Mark Brand Committed by Commit Bot

MojoLPM: Remove re-entrancy and use of RunUntilIdle.

The existing example fuzzer code used RunUntilIdle to avoid runloop
recursion issues caused by re-entrancy in the scheduling of fuzzer
tasks. This change removes the re-entrancy and refactors out the use
of RunUntilIdle, working towards refactoring out the common code
duplication between fuzzers that's currently necessary.

Bug: 1076336
Change-Id: I3729d20264638c00c14c3a8149395e3f22e90089
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2329531
Commit-Queue: Mark Brand <markbrand@google.com>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799545}
parent ed3fbbd4
...@@ -6,7 +6,7 @@ actions { ...@@ -6,7 +6,7 @@ actions {
} }
} }
actions { actions {
code_cache_host_call { code_cache_host_remote_action {
id: 1 id: 1
m_did_generate_cacheable_metadata { m_did_generate_cacheable_metadata {
m_cache_type: CodeCacheType_kJavascript m_cache_type: CodeCacheType_kJavascript
......
...@@ -6,7 +6,7 @@ actions { ...@@ -6,7 +6,7 @@ actions {
} }
} }
actions { actions {
code_cache_host_call { code_cache_host_remote_action {
id: 1 id: 1
m_did_generate_cacheable_metadata { m_did_generate_cacheable_metadata {
m_cache_type: CodeCacheType_kJavascript m_cache_type: CodeCacheType_kJavascript
......
...@@ -54,59 +54,16 @@ class ContentFuzzerEnvironment { ...@@ -54,59 +54,16 @@ class ContentFuzzerEnvironment {
fuzzer_thread_.StartAndWaitForTesting(); fuzzer_thread_.StartAndWaitForTesting();
} }
void RunThreadUntilIdle( scoped_refptr<base::SequencedTaskRunner> fuzzer_task_runner() {
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
if (task_runner->RunsTasksInCurrentSequence()) {
base::RunLoop(base::RunLoop::Type::kNestableTasksAllowed).RunUntilIdle();
} else {
base::WaitableEvent thread_idle(
base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
task_runner->PostTask(
FROM_HERE,
base::BindOnce(
[](base::WaitableEvent* thread_idle) {
base::RunLoop(base::RunLoop::Type::kNestableTasksAllowed)
.RunUntilIdle();
thread_idle->Signal();
},
base::Unretained(&thread_idle)));
thread_idle.Wait();
}
}
void RunUntilIdle() { RunThreadUntilIdle(fuzzer_thread_.task_runner()); }
void RunUIThreadUntilIdle() { RunThreadUntilIdle(ui_task_runner()); }
void RunIOThreadUntilIdle() { RunThreadUntilIdle(io_task_runner()); }
scoped_refptr<base::SequencedTaskRunner> task_runner() {
return fuzzer_thread_.task_runner(); return fuzzer_thread_.task_runner();
} }
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() {
if (!io_task_runner_) {
io_task_runner_ = base::CreateSingleThreadTaskRunner({BrowserThread::IO});
}
return io_task_runner_;
}
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() {
if (!ui_task_runner_) {
ui_task_runner_ = base::CreateSingleThreadTaskRunner({BrowserThread::UI});
}
return ui_task_runner_;
}
private: private:
base::AtExitManager at_exit_manager_; base::AtExitManager at_exit_manager_;
std::unique_ptr<base::FieldTrialList> field_trial_list_; std::unique_ptr<base::FieldTrialList> field_trial_list_;
base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList scoped_feature_list_;
base::Thread fuzzer_thread_; base::Thread fuzzer_thread_;
BrowserTaskEnvironment task_environment_; BrowserTaskEnvironment task_environment_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
TestContentClientInitializer content_client_initializer_; TestContentClientInitializer content_client_initializer_;
}; };
...@@ -116,28 +73,8 @@ ContentFuzzerEnvironment& SingletonEnvironment() { ...@@ -116,28 +73,8 @@ ContentFuzzerEnvironment& SingletonEnvironment() {
return g_environment; return g_environment;
} }
scoped_refptr<base::SequencedTaskRunner> GetTaskRunner() { scoped_refptr<base::SequencedTaskRunner> GetFuzzerTaskRunner() {
return SingletonEnvironment().task_runner(); return SingletonEnvironment().fuzzer_task_runner();
}
scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() {
return SingletonEnvironment().io_task_runner();
}
scoped_refptr<base::SingleThreadTaskRunner> GetUITaskRunner() {
return SingletonEnvironment().ui_task_runner();
}
void RunUntilIdle() {
SingletonEnvironment().RunUntilIdle();
}
void RunIOThreadUntilIdle() {
SingletonEnvironment().RunIOThreadUntilIdle();
}
void RunUIThreadUntilIdle() {
SingletonEnvironment().RunUIThreadUntilIdle();
} }
class CodeCacheHostFuzzerContext : public mojolpm::Context { class CodeCacheHostFuzzerContext : public mojolpm::Context {
...@@ -152,20 +89,14 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context { ...@@ -152,20 +89,14 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context {
kOriginB(url::Origin::Create(GURL("http://bbb.com/"))), kOriginB(url::Origin::Create(GURL("http://bbb.com/"))),
kOriginOpaque(url::Origin::Create(GURL("opaque"))), kOriginOpaque(url::Origin::Create(GURL("opaque"))),
kOriginEmpty(url::Origin::Create(GURL("file://this_becomes_empty"))), kOriginEmpty(url::Origin::Create(GURL("file://this_becomes_empty"))),
browser_context_() {} browser_context_() {
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
void InitializeServices() { base::PostTaskAndReply(
if (!initialized_) { FROM_HERE, {BrowserThread::UI},
base::PostTask( base::BindOnce(&CodeCacheHostFuzzerContext::InitializeOnUIThread,
FROM_HERE, {BrowserThread::UI}, base::Unretained(this)),
base::BindOnce(&CodeCacheHostFuzzerContext::InitializeOnUIThread, run_loop.QuitClosure());
base::Unretained(this))); run_loop.Run();
RunUIThreadUntilIdle();
RunUntilIdle();
initialized_ = true;
}
} }
void InitializeOnUIThread() { void InitializeOnUIThread() {
...@@ -180,41 +111,23 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context { ...@@ -180,41 +111,23 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context {
65536); 65536);
} }
void CleanupServices() {
base::PostTask(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(&CodeCacheHostFuzzerContext::CleanupOnUIThread,
base::Unretained(this)));
RunUIThreadUntilIdle();
RunUntilIdle();
initialized_ = false;
}
void CleanupOnUIThread() {}
void AddCodeCacheHostImpl( void AddCodeCacheHostImpl(
uint32_t id, uint32_t id,
int renderer_id, int renderer_id,
const Origin& origin, const Origin& origin,
mojo::PendingReceiver<::blink::mojom::CodeCacheHost>&& receiver, mojo::PendingReceiver<::blink::mojom::CodeCacheHost>&& receiver) {
base::WaitableEvent* receiver_bound) {
code_cache_hosts_[renderer_id] = std::make_unique<CodeCacheHostImpl>( code_cache_hosts_[renderer_id] = std::make_unique<CodeCacheHostImpl>(
renderer_id, cache_storage_context_, generated_code_cache_context_, renderer_id, cache_storage_context_, generated_code_cache_context_,
std::move(receiver)); std::move(receiver));
receiver_bound->Signal();
} }
void AddCodeCacheHost( void AddCodeCacheHost(
uint32_t id, uint32_t id,
int renderer_id, int renderer_id,
content::fuzzing::code_cache_host::proto::NewCodeCacheHost::OriginId content::fuzzing::code_cache_host::proto::NewCodeCacheHostAction::OriginId
origin_id) { origin_id) {
mojo::Remote<::blink::mojom::CodeCacheHost> remote; mojo::Remote<::blink::mojom::CodeCacheHost> remote;
auto receiver = remote.BindNewPipeAndPassReceiver(); auto receiver = remote.BindNewPipeAndPassReceiver();
base::WaitableEvent receiver_bound;
const Origin* origin = &kOriginA; const Origin* origin = &kOriginA;
if (origin_id == 1) { if (origin_id == 1) {
...@@ -225,13 +138,14 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context { ...@@ -225,13 +138,14 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context {
origin = &kOriginEmpty; origin = &kOriginEmpty;
} }
GetUITaskRunner()->PostTask( base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
FROM_HERE, base::PostTaskAndReply(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(&CodeCacheHostFuzzerContext::AddCodeCacheHostImpl, base::BindOnce(&CodeCacheHostFuzzerContext::AddCodeCacheHostImpl,
base::Unretained(this), id, renderer_id, *origin, base::Unretained(this), id, renderer_id, *origin,
std::move(receiver), base::Unretained(&receiver_bound))); std::move(receiver)),
run_loop.QuitClosure());
receiver_bound.Wait(); run_loop.Run();
AddInstance(id, std::move(remote)); AddInstance(id, std::move(remote));
} }
...@@ -239,8 +153,6 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context { ...@@ -239,8 +153,6 @@ class CodeCacheHostFuzzerContext : public mojolpm::Context {
private: private:
TestBrowserContext browser_context_; TestBrowserContext browser_context_;
bool initialized_ = false;
scoped_refptr<CacheStorageContextImpl> cache_storage_context_; scoped_refptr<CacheStorageContextImpl> cache_storage_context_;
scoped_refptr<GeneratedCodeCacheContext> generated_code_cache_context_; scoped_refptr<GeneratedCodeCacheContext> generated_code_cache_context_;
...@@ -295,17 +207,23 @@ void CodeCacheHostTestcase::NextAction() { ...@@ -295,17 +207,23 @@ void CodeCacheHostTestcase::NextAction() {
action.new_code_cache_host().origin_id()); action.new_code_cache_host().origin_id());
} break; } break;
case content::fuzzing::code_cache_host::proto::Action::kRunUntilIdle: { case content::fuzzing::code_cache_host::proto::Action::kRunThread: {
if (action.run_until_idle().id()) { if (action.run_thread().id()) {
content::RunUIThreadUntilIdle(); base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
run_loop.QuitClosure());
run_loop.Run();
} else { } else {
content::RunIOThreadUntilIdle(); base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::PostTask(FROM_HERE, {content::BrowserThread::IO},
run_loop.QuitClosure());
run_loop.Run();
} }
} break; } break;
case content::fuzzing::code_cache_host::proto::Action:: case content::fuzzing::code_cache_host::proto::Action::
kCodeCacheHostCall: { kCodeCacheHostRemoteAction: {
mojolpm::HandleRemoteCall(action.code_cache_host_call()); mojolpm::HandleRemoteAction(action.code_cache_host_remote_action());
} break; } break;
case content::fuzzing::code_cache_host::proto::Action::ACTION_NOT_SET: case content::fuzzing::code_cache_host::proto::Action::ACTION_NOT_SET:
...@@ -315,28 +233,36 @@ void CodeCacheHostTestcase::NextAction() { ...@@ -315,28 +233,36 @@ void CodeCacheHostTestcase::NextAction() {
} }
} }
void run_testcase( void NextAction(content::CodeCacheHostFuzzerContext* context,
base::RepeatingClosure quit_closure) {
if (!context->IsFinished()) {
context->NextAction();
content::GetFuzzerTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(NextAction, base::Unretained(context),
std::move(quit_closure)));
} else {
content::GetFuzzerTaskRunner()->PostTask(FROM_HERE,
std::move(quit_closure));
}
}
void RunTestcase(
content::CodeCacheHostFuzzerContext* context, content::CodeCacheHostFuzzerContext* context,
const content::fuzzing::code_cache_host::proto::Testcase* testcase, const content::fuzzing::code_cache_host::proto::Testcase* testcase) {
base::RepeatingClosure&& quit_closure) {
mojo::Message message; mojo::Message message;
auto dispatch_context = auto dispatch_context =
std::make_unique<mojo::internal::MessageDispatchContext>(&message); std::make_unique<mojo::internal::MessageDispatchContext>(&message);
CodeCacheHostTestcase cch_testcase(*context, *testcase); CodeCacheHostTestcase cch_testcase(*context, *testcase);
context->StartTestcase(&cch_testcase, content::GetTaskRunner()); context->StartTestcase(&cch_testcase, content::GetFuzzerTaskRunner());
while (!context->IsFinished()) { base::RunLoop fuzzer_run_loop(base::RunLoop::Type::kNestableTasksAllowed);
context->NextAction(); content::GetFuzzerTaskRunner()->PostTask(
content::RunUntilIdle(); FROM_HERE, base::BindOnce(NextAction, base::Unretained(context),
} fuzzer_run_loop.QuitClosure()));
fuzzer_run_loop.Run();
content::RunIOThreadUntilIdle();
content::RunUIThreadUntilIdle();
context->EndTestcase(); context->EndTestcase();
content::GetTaskRunner()->PostTask(FROM_HERE, std::move(quit_closure));
} }
DEFINE_BINARY_PROTO_FUZZER( DEFINE_BINARY_PROTO_FUZZER(
...@@ -347,18 +273,14 @@ DEFINE_BINARY_PROTO_FUZZER( ...@@ -347,18 +273,14 @@ DEFINE_BINARY_PROTO_FUZZER(
} }
content::CodeCacheHostFuzzerContext context; content::CodeCacheHostFuzzerContext context;
context.InitializeServices();
mojolpm::SetContext(&context); mojolpm::SetContext(&context);
base::RunLoop ui_nested_runloop{base::RunLoop::Type::kNestableTasksAllowed}; base::RunLoop ui_run_loop(base::RunLoop::Type::kNestableTasksAllowed);
auto ui_nested_quit = ui_nested_runloop.QuitClosure(); content::GetFuzzerTaskRunner()->PostTaskAndReply(
content::GetTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce(run_testcase, base::Unretained(&context), base::BindOnce(RunTestcase, base::Unretained(&context),
base::Unretained(&testcase), std::move(ui_nested_quit))); base::Unretained(&testcase)),
ui_run_loop.QuitClosure());
ui_nested_runloop.Run();
context.CleanupServices(); ui_run_loop.Run();
} }
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Message format for the MojoLPM fuzzer for the CodeCacheHost interface.
syntax = "proto2"; syntax = "proto2";
package content.fuzzing.code_cache_host.proto; package content.fuzzing.code_cache_host.proto;
import "third_party/blink/public/mojom/loader/code_cache.mojom.mojolpm.proto"; import "third_party/blink/public/mojom/loader/code_cache.mojom.mojolpm.proto";
message NewCodeCacheHost { // Bind a new CodeCacheHost remote
message NewCodeCacheHostAction {
enum OriginId { enum OriginId {
ORIGIN_A = 0; ORIGIN_A = 0;
ORIGIN_B = 1; ORIGIN_B = 1;
...@@ -17,7 +24,10 @@ message NewCodeCacheHost { ...@@ -17,7 +24,10 @@ message NewCodeCacheHost {
required OriginId origin_id = 3; required OriginId origin_id = 3;
} }
message RunUntilIdle { // Run the specific sequence for (an indeterminate) period. This is not
// intended to create a specific ordering, but to allow the fuzzer to delay a
// later task until previous tasks have completed.
message RunThreadAction {
enum ThreadId { enum ThreadId {
IO = 0; IO = 0;
UI = 1; UI = 1;
...@@ -26,18 +36,23 @@ message RunUntilIdle { ...@@ -26,18 +36,23 @@ message RunUntilIdle {
required ThreadId id = 1; required ThreadId id = 1;
} }
// Actions that can be performed by the fuzzer.
message Action { message Action {
oneof action { oneof action {
NewCodeCacheHost new_code_cache_host = 1; NewCodeCacheHostAction new_code_cache_host = 1;
RunUntilIdle run_until_idle = 2; RunThreadAction run_thread = 2;
mojolpm.blink.mojom.CodeCacheHost.RemoteCall code_cache_host_call = 3; mojolpm.blink.mojom.CodeCacheHost.RemoteAction
code_cache_host_remote_action = 3;
} }
} }
// Sequence provides a level of indirection which allows Testcase to compactly
// express repeated sequences of actions.
message Sequence { message Sequence {
repeated uint32 action_indexes = 1 [packed = true]; repeated uint32 action_indexes = 1 [packed = true];
} }
// Testcase is the top-level message type interpreted by the fuzzer.
message Testcase { message Testcase {
repeated Action actions = 1; repeated Action actions = 1;
repeated Sequence sequences = 2; repeated Sequence sequences = 2;
......
...@@ -93,7 +93,6 @@ class {{interface.name}}Impl : public {{mojom_type}} { ...@@ -93,7 +93,6 @@ class {{interface.name}}Impl : public {{mojom_type}} {
{%- if method.response_parameters != None %} {%- if method.response_parameters != None %}
mojolpm::GetContext()->AddInstance<{{mojom_type}}::{{method.name}}Callback>(std::move(callback)); mojolpm::GetContext()->AddInstance<{{mojom_type}}::{{method.name}}Callback>(std::move(callback));
{%- endif %} {%- endif %}
mojolpm::GetContext()->NextAction();
} }
{%- endfor %} {%- endfor %}
}; };
...@@ -251,16 +250,16 @@ bool ToProto(::mojo::PendingAssociatedReceiver<{{mojom_type}}>&& input, ...@@ -251,16 +250,16 @@ bool ToProto(::mojo::PendingAssociatedReceiver<{{mojom_type}}>&& input,
{%- set mojom_type = interface|get_qualified_name_for_kind(flatten_nested_kind=True) %} {%- set mojom_type = interface|get_qualified_name_for_kind(flatten_nested_kind=True) %}
{%- set proto_type = "::mojolpm" ~ (interface|get_qualified_name_for_kind(flatten_nested_kind=True)) %} {%- set proto_type = "::mojolpm" ~ (interface|get_qualified_name_for_kind(flatten_nested_kind=True)) %}
{%- if interface.methods %} {%- if interface.methods %}
bool HandleRemoteCall(const {{proto_type}}::RemoteCall& input) { bool HandleRemoteAction(const {{proto_type}}::RemoteAction& input) {
bool result = true; bool result = true;
switch (input.method_case()) { switch (input.method_case()) {
{%- for method in interface.methods %} {%- for method in interface.methods %}
case {{proto_type}}::RemoteCall::k{{("m_" ~ method.name)|under_to_camel(digits_split=True)}}: { case {{proto_type}}::RemoteAction::k{{("m_" ~ method.name)|under_to_camel(digits_split=True)}}: {
result = HandleRemoteCall(input.id(), input.{{("m" ~ method.name)|camel_to_under}}()); result = HandleRemoteCall(input.id(), input.{{("m" ~ method.name)|camel_to_under}}());
} break; } break;
{%- endfor %} {%- endfor %}
case {{proto_type}}::RemoteCall::kReset: { case {{proto_type}}::RemoteAction::kReset: {
mojolpm::GetContext()->GetAndRemoveInstance<::mojo::Remote<{{mojom_type}}>>(input.id()); mojolpm::GetContext()->GetAndRemoveInstance<::mojo::Remote<{{mojom_type}}>>(input.id());
} break; } break;
...@@ -272,16 +271,16 @@ bool HandleRemoteCall(const {{proto_type}}::RemoteCall& input) { ...@@ -272,16 +271,16 @@ bool HandleRemoteCall(const {{proto_type}}::RemoteCall& input) {
return result; return result;
} }
bool HandleAssociatedRemoteCall(const {{proto_type}}::AssociatedRemoteCall& input) { bool HandleAssociatedRemoteAction(const {{proto_type}}::AssociatedRemoteAction& input) {
bool result = true; bool result = true;
switch (input.method_case()) { switch (input.method_case()) {
{%- for method in interface.methods %} {%- for method in interface.methods %}
case {{proto_type}}::AssociatedRemoteCall::k{{("m_" ~ method.name)|under_to_camel(digits_split=True)}}: { case {{proto_type}}::AssociatedRemoteAction::k{{("m_" ~ method.name)|under_to_camel(digits_split=True)}}: {
result = HandleAssociatedRemoteCall(input.id(), input.{{("m" ~ method.name)|camel_to_under}}()); result = HandleAssociatedRemoteCall(input.id(), input.{{("m" ~ method.name)|camel_to_under}}());
} break; } break;
{%- endfor %} {%- endfor %}
case {{proto_type}}::AssociatedRemoteCall::kReset: { case {{proto_type}}::AssociatedRemoteAction::kReset: {
mojolpm::GetContext()->GetAndRemoveInstance<::mojo::AssociatedRemote<{{mojom_type}}>>(input.id()); mojolpm::GetContext()->GetAndRemoveInstance<::mojo::AssociatedRemote<{{mojom_type}}>>(input.id());
} break; } break;
...@@ -293,12 +292,12 @@ bool HandleAssociatedRemoteCall(const {{proto_type}}::AssociatedRemoteCall& inpu ...@@ -293,12 +292,12 @@ bool HandleAssociatedRemoteCall(const {{proto_type}}::AssociatedRemoteCall& inpu
return result; return result;
} }
bool HandleResponse( bool HandleReceiverAction(
const {{proto_type}}::ReceiverResponse& input) { const {{proto_type}}::ReceiverAction& input) {
bool result = true; bool result = true;
switch (input.response_case()) { switch (input.response_case()) {
{%- for method in interface.methods %} {%- for method in interface.methods %}
case {{proto_type}}::ReceiverResponse::k{{("m_" ~ method.name ~ "_response")|under_to_camel(digits_split=True)}}: { case {{proto_type}}::ReceiverAction::k{{("m_" ~ method.name ~ "_response")|under_to_camel(digits_split=True)}}: {
result = HandleResponse(input.id(), input.{{("m" ~ method.name ~ "_response")|camel_to_under}}()); result = HandleResponse(input.id(), input.{{("m" ~ method.name ~ "_response")|camel_to_under}}());
} break; } break;
{%- endfor %} {%- endfor %}
...@@ -326,7 +325,6 @@ static void {{interface.name}}_{{method.name}}Callback( ...@@ -326,7 +325,6 @@ static void {{interface.name}}_{{method.name}}Callback(
{{ util.add_instance(kind, 'param_' ~ name, False) }} {{ util.add_instance(kind, 'param_' ~ name, False) }}
{%- endfor %} {%- endfor %}
mojolpmdbg("{{interface.name}}.{{method.name}}Callback\n"); mojolpmdbg("{{interface.name}}.{{method.name}}Callback\n");
mojolpm::GetContext()->NextAction();
}{{"\n"-}} }{{"\n"-}}
{%- endif %} {%- endif %}
template <typename T> template <typename T>
......
...@@ -177,14 +177,14 @@ bool ToProto( ...@@ -177,14 +177,14 @@ bool ToProto(
{%- set mojom_type = interface|get_qualified_name_for_kind(flatten_nested_kind=True) %} {%- set mojom_type = interface|get_qualified_name_for_kind(flatten_nested_kind=True) %}
{%- set proto_type = "::mojolpm" ~ (interface|get_qualified_name_for_kind(flatten_nested_kind=True)) %} {%- set proto_type = "::mojolpm" ~ (interface|get_qualified_name_for_kind(flatten_nested_kind=True)) %}
{%- if interface.methods %} {%- if interface.methods %}
bool HandleRemoteCall( bool HandleRemoteAction(
const {{proto_type}}::RemoteCall& input); const {{proto_type}}::RemoteAction& input);
bool HandleAssociatedRemoteCall( bool HandleAssociatedRemoteAction(
const {{proto_type}}::AssociatedRemoteCall& input); const {{proto_type}}::AssociatedRemoteAction& input);
bool HandleResponse( bool HandleReceiverAction(
const {{proto_type}}::ReceiverResponse& response);{{"\n"-}} const {{proto_type}}::ReceiverAction& input);{{"\n"-}}
{%- for method in interface.methods %} {%- for method in interface.methods %}
bool HandleRemoteCall( bool HandleRemoteCall(
uint32_t instance_id, uint32_t instance_id,
......
...@@ -316,7 +316,7 @@ message {{interface.name}} { ...@@ -316,7 +316,7 @@ message {{interface.name}} {
{%- endfor%} {%- endfor%}
{%- if interface.methods|length %} {%- if interface.methods|length %}
message RemoteCall { message RemoteAction {
required uint32 id = 1; required uint32 id = 1;
oneof method { oneof method {
...@@ -327,7 +327,7 @@ message {{interface.name}} { ...@@ -327,7 +327,7 @@ message {{interface.name}} {
} }
} }
message AssociatedRemoteCall { message AssociatedRemoteAction {
required uint32 id = 1; required uint32 id = 1;
oneof method { oneof method {
...@@ -338,7 +338,7 @@ message {{interface.name}} { ...@@ -338,7 +338,7 @@ message {{interface.name}} {
} }
} }
message ReceiverResponse { message ReceiverAction {
required uint32 id = 1; required uint32 id = 1;
oneof response { oneof response {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment