Commit 46c535d2 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Make RunLoop::Delegate methods public.

This mimics the pre-existing paradigm for MessagePump::Delegate :
public methods on Delegate which are then privately inherited.

There were cr-dev discussions on these topics (composition vs private
inheritance) but I don't see a reason to deviate from the
pre-established MessagePump paradigm here.
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/XdsXTHy9lis/discussion
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/CwzjcWd9cYM/discussion

I did consider composition here (e.g. with a private RunDelegate
class in MessageLoop, but the many outer_-> in
Run/Quit/EnsureWorkScheduled made it ugly.

R=danakj@chromium.org

Bug: 708584
Change-Id: I42830b3a28d29b1a518db4cfc767a655de491a90
Reviewed-on: https://chromium-review.googlesource.com/798290Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521227}
parent 4bc282bb
...@@ -157,7 +157,7 @@ class BASE_EXPORT RunLoop { ...@@ -157,7 +157,7 @@ class BASE_EXPORT RunLoop {
// via RunLoop::RegisterDelegateForCurrentThread() before RunLoop instances // via RunLoop::RegisterDelegateForCurrentThread() before RunLoop instances
// and RunLoop static methods can be used on it. // and RunLoop static methods can be used on it.
class BASE_EXPORT Delegate { class BASE_EXPORT Delegate {
protected: public:
Delegate(); Delegate();
~Delegate(); ~Delegate();
...@@ -183,11 +183,6 @@ class BASE_EXPORT RunLoop { ...@@ -183,11 +183,6 @@ class BASE_EXPORT RunLoop {
Delegate* outer_; Delegate* outer_;
}; };
private:
// While the state is owned by the Delegate subclass, only RunLoop can use
// it.
friend class RunLoop;
// Used by RunLoop to inform its Delegate to Run/Quit. Implementations are // Used by RunLoop to inform its Delegate to Run/Quit. Implementations are
// expected to keep on running synchronously from the Run() call until the // expected to keep on running synchronously from the Run() call until the
// eventual matching Quit() call. Upon receiving a Quit() call it should // eventual matching Quit() call. Upon receiving a Quit() call it should
...@@ -212,6 +207,11 @@ class BASE_EXPORT RunLoop { ...@@ -212,6 +207,11 @@ class BASE_EXPORT RunLoop {
// system messages. // system messages.
virtual void EnsureWorkScheduled() = 0; virtual void EnsureWorkScheduled() = 0;
private:
// While the state is owned by the Delegate subclass, only RunLoop can use
// it.
friend class RunLoop;
// A vector-based stack is more memory efficient than the default // A vector-based stack is more memory efficient than the default
// deque-based stack as the active RunLoop stack isn't expected to ever // deque-based stack as the active RunLoop stack isn't expected to ever
// have more than a few entries. // have more than a few entries.
......
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