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

Unified Diff: remoting/host/local_input_monitor_mac.mm

Issue 8670005: Fixed slowdown due to local input monitoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/local_input_monitor_mac.mm
diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm
index 356d098252afc9ca3c7bdfe76d853340db818344..2077a96dfcd377f9d030c4e19febdb22585d2f86 100644
--- a/remoting/host/local_input_monitor_mac.mm
+++ b/remoting/host/local_input_monitor_mac.mm
@@ -28,6 +28,7 @@ typedef std::set<remoting::ChromotingHost*> Hosts;
@private
GTMCarbonHotKey* hotKey_;
CFRunLoopSourceRef mouseRunLoopSource_;
+ base::mac::ScopedCFTypeRef<CFMachPortRef> mouseMachPort_;
base::Lock hostsLock_;
Hosts hosts_;
}
@@ -78,18 +79,18 @@ static CGEventRef LocalMouseMoved(CGEventTapProxy proxy, CGEventType type,
if (!hotKey_) {
LOG(ERROR) << "registerHotKey failed.";
}
- base::mac::ScopedCFTypeRef<CFMachPortRef> mouseMachPort(CGEventTapCreate(
+ mouseMachPort_.reset(CGEventTapCreate(
kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
1 << kCGEventMouseMoved, LocalMouseMoved, self));
- if (mouseMachPort) {
+ if (mouseMachPort_) {
mouseRunLoopSource_ = CFMachPortCreateRunLoopSource(
- NULL, mouseMachPort, 0);
+ NULL, mouseMachPort_, 0);
CFRunLoopAddSource(
CFRunLoopGetMain(), mouseRunLoopSource_, kCFRunLoopCommonModes);
} else {
LOG(ERROR) << "CGEventTapCreate failed.";
}
- if (!hotKey_ && !mouseMachPort) {
+ if (!hotKey_ && !mouseMachPort_) {
[self release];
return nil;
}
@@ -119,9 +120,11 @@ static CGEventRef LocalMouseMoved(CGEventTapProxy proxy, CGEventType type,
hotKey_ = NULL;
}
if (mouseRunLoopSource_) {
+ CFMachPortInvalidate(mouseMachPort_);
CFRunLoopRemoveSource(
CFRunLoopGetMain(), mouseRunLoopSource_, kCFRunLoopCommonModes);
CFRelease(mouseRunLoopSource_);
+ mouseMachPort_.reset(0);
mouseRunLoopSource_ = NULL;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698