MessageLoop is not designed to be subclassed.  Call me a minimalist, but I
think it damages slightly the readability of the code to have methods marked
virtual that do not need to be.  That said, I love mocking.  Since a lot of
code doesn't actually need a MessageLoop so much as a place to post tasks,
maybe it would be better to define an interface for posting tasks that
MessageLoop can implement.  Then a lot of code could be switched over to
that interface, making the code a bit more abstract.  Think of
IPC::Message::Sender as an example of this kind of abstraction.
-Darin


On Mon, Aug 3, 2009 at 8:23 PM, Albert J. Wong (王重傑) <ajw...@chromium.org>wrote:

> I've noticed that most public functions on MessageLoop are non-virtual.
>  How bad would it be to make PostTask, and its variants, virtual?  Are the
> perf implications or similar that would be bad?
> I'd like to be able to use gmock to mock out a message loop so I can test
> if my code knows to stop posting tasks.  However, not having the message
> loop be virtual makes this hard.
>
> Thanks,
> Albert
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to