| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/base/x/selection_owner.h" | 5 #include "ui/base/x/selection_owner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // The period of |incremental_transfer_abort_timer_|. Arbitrary but must be <= | 35 // The period of |incremental_transfer_abort_timer_|. Arbitrary but must be <= |
| 36 // than kIncrementalTransferTimeoutMs. | 36 // than kIncrementalTransferTimeoutMs. |
| 37 const int kTimerPeriodMs = 1000; | 37 const int kTimerPeriodMs = 1000; |
| 38 | 38 |
| 39 // The amount of time to wait for the selection requestor to process the data | 39 // The amount of time to wait for the selection requestor to process the data |
| 40 // sent by the selection owner before aborting an incremental data transfer. | 40 // sent by the selection owner before aborting an incremental data transfer. |
| 41 const int kIncrementalTransferTimeoutMs = 10000; | 41 const int kIncrementalTransferTimeoutMs = 10000; |
| 42 | 42 |
| 43 COMPILE_ASSERT(kTimerPeriodMs <= kIncrementalTransferTimeoutMs, | 43 static_assert(kTimerPeriodMs <= kIncrementalTransferTimeoutMs, |
| 44 timer_period_must_be_less_or_equal_to_transfer_timeout); | 44 "timer period must be <= transfer timeout"); |
| 45 | 45 |
| 46 // Returns a conservative max size of the data we can pass into | 46 // Returns a conservative max size of the data we can pass into |
| 47 // XChangeProperty(). Copied from GTK. | 47 // XChangeProperty(). Copied from GTK. |
| 48 size_t GetMaxRequestSize(XDisplay* display) { | 48 size_t GetMaxRequestSize(XDisplay* display) { |
| 49 long extended_max_size = XExtendedMaxRequestSize(display); | 49 long extended_max_size = XExtendedMaxRequestSize(display); |
| 50 long max_size = | 50 long max_size = |
| 51 (extended_max_size ? extended_max_size : XMaxRequestSize(display)) - 100; | 51 (extended_max_size ? extended_max_size : XMaxRequestSize(display)) - 100; |
| 52 return std::min(static_cast<long>(0x40000), | 52 return std::min(static_cast<long>(0x40000), |
| 53 std::max(static_cast<long>(0), max_size)); | 53 std::max(static_cast<long>(0), max_size)); |
| 54 } | 54 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 data(data), | 375 data(data), |
| 376 offset(offset), | 376 offset(offset), |
| 377 timeout(timeout), | 377 timeout(timeout), |
| 378 foreign_window_manager_id(foreign_window_manager_id) { | 378 foreign_window_manager_id(foreign_window_manager_id) { |
| 379 } | 379 } |
| 380 | 380 |
| 381 SelectionOwner::IncrementalTransfer::~IncrementalTransfer() { | 381 SelectionOwner::IncrementalTransfer::~IncrementalTransfer() { |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace ui | 384 } // namespace ui |
| OLD | NEW |