Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
Adding back missing changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalyankondapally committed Sep 2, 2013
1 parent fb1e661 commit 2e629fe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
31 changes: 29 additions & 2 deletions impl/event_factory_wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ EventFactoryWayland::EventFactoryWayland()
: fd_(-1) {
LOG(INFO) << "Ozone: EventFactoryWayland";
WaylandDisplay* dis = WaylandDisplay::GetDisplay();
WaylandDispatcher::HandleFlush();
//WaylandDispatcher::HandleFlush();

fd_ = wl_display_get_fd(dis->display());

Expand All @@ -33,8 +33,10 @@ EventFactoryWayland::EventFactoryWayland()

loop_ = base::MessageLoop::current();

if (loop_)
if (loop_) {
loop_->AddDestructionObserver(this);
loop_->AddTaskObserver(this);
}
}

EventFactoryWayland::~EventFactoryWayland() {
Expand All @@ -56,6 +58,30 @@ void EventFactoryWayland::OnFileCanWriteWithoutBlocking(int fd) {
NOTREACHED();
}

void EventFactoryWayland::WillProcessTask(
const base::PendingTask& pending_task) {
}

void EventFactoryWayland::DidProcessTask(
const base::PendingTask& pending_task) {

// a proper integration of libwayland should call wl_display_flush() only
// before the client's event loop is about to go sleep. Ideally libevent
// would emit a signal mentioning its intent to sleep and libwayland would
// flush the remaining buffered bytes.
// The catch with this hack in DidProcessTask is to be careful and flush only
// when needed like after eglSwapBuffers (PostSwapBuffersComplete) and others
// This would not be needed after we start using transport surface, as nested
// server would be responsible for flushing the client as needed. We need to
// come back to this once we have it working.

if (strcmp(pending_task.posted_from.function_name(),
"PostSwapBuffersComplete") != 0)
return;

WaylandDisplay::GetDisplay()->Dispatcher()->PostTask();
}

void EventFactoryWayland::WillDestroyCurrentMessageLoop()
{
DCHECK(base::MessageLoop::current());
Expand All @@ -65,6 +91,7 @@ void EventFactoryWayland::WillDestroyCurrentMessageLoop()

watcher_.StopWatchingFileDescriptor();
base::MessageLoop::current()->RemoveDestructionObserver(this);
base::MessageLoop::current()->RemoveTaskObserver(this);
loop_ = NULL;
}
}
Expand Down
8 changes: 7 additions & 1 deletion impl/event_factory_wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace ui {

class WaylandDisplay;

class EventFactoryWayland : public base::MessagePumpLibevent::Watcher,
class EventFactoryWayland : public base::MessageLoop::TaskObserver,
public base::MessagePumpLibevent::Watcher,
public base::MessageLoop::DestructionObserver {
public:
EventFactoryWayland();
Expand All @@ -29,9 +30,14 @@ class EventFactoryWayland : public base::MessagePumpLibevent::Watcher,
// base::MessagePump:Libevent::Watcher implementation.
virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;

// MessageLoop::DestructionObserver overrides.
virtual void WillDestroyCurrentMessageLoop() OVERRIDE;

// Implements MessageLoop::TaskObserver.
virtual void WillProcessTask(const base::PendingTask& pending_task);
virtual void DidProcessTask(const base::PendingTask& pending_task);

int fd_;
base::MessageLoop* loop_;
base::MessagePumpLibevent::FileDescriptorWatcher watcher_;
Expand Down

3 comments on commit 2e629fe

@tiagovignatti
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole patch is ALSO superfluous and makes the review process just harder. You changed something a priori, didn't mention why and here you brought it back without justifying. Please clean up your Patch Sets before showing them for review @kalyankondapally

@kalyankondapally
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiagovignatti With recenet IRC discussion, I will publish a new review request with appropriate commit messages. You can go through these, if you want to get familiar with what is coming. Probably I will put up another review tomorrow.

@kalyankondapally
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiagovignatti It should have been more like unintended changes. Anyways ignore the commit messages for now, I will issue a new review request for this.

Please sign in to comment.