| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" | 5 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 | 8 |
| 9 #if defined(USE_GLIB) | 9 #if defined(USE_GLIB) |
| 10 #include <glib.h> | 10 #include <glib.h> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // The GLib event source for wayland events. | 84 // The GLib event source for wayland events. |
| 85 GLibWaylandSource* wayland_source_; | 85 GLibWaylandSource* wayland_source_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(WaylandWatcher); | 87 DISALLOW_COPY_AND_ASSIGN(WaylandWatcher); |
| 88 }; | 88 }; |
| 89 #else | 89 #else |
| 90 class ChromeBrowserMainExtraPartsExo::WaylandWatcher | 90 class ChromeBrowserMainExtraPartsExo::WaylandWatcher |
| 91 : public base::MessagePumpLibevent::Watcher { | 91 : public base::MessagePumpLibevent::Watcher { |
| 92 public: | 92 public: |
| 93 explicit WaylandWatcher(exo::wayland::Server* server) : server_(server) { | 93 explicit WaylandWatcher(exo::wayland::Server* server) |
| 94 : controller_(FROM_HERE), server_(server) { |
| 94 base::MessageLoopForUI::current()->WatchFileDescriptor( | 95 base::MessageLoopForUI::current()->WatchFileDescriptor( |
| 95 server_->GetFileDescriptor(), | 96 server_->GetFileDescriptor(), |
| 96 true, // persistent | 97 true, // persistent |
| 97 base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 98 base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
| 98 } | 99 } |
| 99 | 100 |
| 100 // base::MessagePumpLibevent::Watcher: | 101 // base::MessagePumpLibevent::Watcher: |
| 101 void OnFileCanReadWithoutBlocking(int fd) override { | 102 void OnFileCanReadWithoutBlocking(int fd) override { |
| 102 server_->Dispatch(base::TimeDelta()); | 103 server_->Dispatch(base::TimeDelta()); |
| 103 server_->Flush(); | 104 server_->Flush(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 | 139 |
| 139 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() { | 140 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() { |
| 140 wayland_watcher_.reset(); | 141 wayland_watcher_.reset(); |
| 141 wayland_server_.reset(); | 142 wayland_server_.reset(); |
| 142 if (wm_helper_) { | 143 if (wm_helper_) { |
| 143 exo::WMHelper::SetInstance(nullptr); | 144 exo::WMHelper::SetInstance(nullptr); |
| 144 wm_helper_.reset(); | 145 wm_helper_.reset(); |
| 145 } | 146 } |
| 146 } | 147 } |
| OLD | NEW |