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

Unified Diff: mojo/public/cpp/bindings/lib/router.cc

Issue 1003773002: CPP bindings: DCHECK when a Callback is destructed without being invoked (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased again Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/router.cc
diff --git a/mojo/public/cpp/bindings/lib/router.cc b/mojo/public/cpp/bindings/lib/router.cc
index da1e7e122024496d9e1f0433497d3712af591573..e64f1fa0a1224100b615ad83df28d0b21b755a9c 100644
--- a/mojo/public/cpp/bindings/lib/router.cc
+++ b/mojo/public/cpp/bindings/lib/router.cc
@@ -11,7 +11,7 @@ namespace internal {
// ----------------------------------------------------------------------------
-class ResponderThunk : public MessageReceiver {
+class ResponderThunk : public MessageReceiverWithStatus {
public:
explicit ResponderThunk(const SharedData<Router*>& router)
: router_(router), accept_was_invoked_(false) {}
@@ -44,6 +44,12 @@ class ResponderThunk : public MessageReceiver {
return result;
}
+ // MessageReceiverWithStatus implementation:
+ bool IsValid() override {
+ Router* router = router_.value();
+ return router && !router->encountered_error() && router->is_valid();
+ }
+
private:
SharedData<Router*> router_;
bool accept_was_invoked_;
@@ -118,7 +124,7 @@ void Router::EnableTestingMode() {
bool Router::HandleIncomingMessage(Message* message) {
if (message->has_flag(kMessageExpectsResponse)) {
if (incoming_receiver_) {
- MessageReceiver* responder = new ResponderThunk(weak_self_);
+ MessageReceiverWithStatus* responder = new ResponderThunk(weak_self_);
bool ok = incoming_receiver_->AcceptWithResponder(message, responder);
if (!ok)
delete responder;
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698