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

Unified Diff: ui/base/x/selection_requestor.h

Issue 391593002: Process SelectionRequestor::PerformBlockingConvertSelection() requests one at a time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months 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
Index: ui/base/x/selection_requestor.h
diff --git a/ui/base/x/selection_requestor.h b/ui/base/x/selection_requestor.h
index e092850532a546f655838e561defb430302af5e3..ea847a0869709c49969dfce133cc2c0f40c47d35 100644
--- a/ui/base/x/selection_requestor.h
+++ b/ui/base/x/selection_requestor.h
@@ -7,11 +7,7 @@
#include <X11/Xlib.h>
-// Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
-#undef RootWindow
-
#include <list>
-#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
@@ -34,29 +30,31 @@ class UI_BASE_EXPORT SelectionRequestor {
public:
SelectionRequestor(Display* xdisplay,
::Window xwindow,
- ::Atom selection_name,
PlatformEventDispatcher* dispatcher);
~SelectionRequestor();
- // Does the work of requesting |target| from the selection we handle,
- // spinning up the nested message loop, and reading the resulting data
- // back. The result is stored in |out_data|.
+ // Does the work of requesting |target| from |selection|, spinning up the
+ // nested message loop, and reading the resulting data back. The result is
+ // stored in |out_data|.
// |out_data_items| is the length of |out_data| in |out_type| items.
bool PerformBlockingConvertSelection(
+ ::Atom selection,
::Atom target,
scoped_refptr<base::RefCountedMemory>* out_data,
size_t* out_data_items,
::Atom* out_type);
- // Requests |target| from the selection that we handle, passing |parameter|
- // as a parameter to XConvertSelection().
+ // Requests |target| from |selection|, passing |parameter| as a parameter to
+ // XConvertSelection().
void PerformBlockingConvertSelectionWithParameter(
+ ::Atom selection,
::Atom target,
const std::vector< ::Atom>& parameter);
- // Returns the first of |types| offered by the current selection holder, or
- // returns NULL if none of those types are available.
- SelectionData RequestAndWaitForTypes(const std::vector< ::Atom>& types);
+ // Returns the first of |types| offered by the current owner of |selection|,
+ // or returns NULL if none of those types are available.
+ SelectionData RequestAndWaitForTypes(::Atom selection,
+ const std::vector< ::Atom>& types);
// It is our owner's responsibility to plumb X11 SelectionNotify events on
// |xwindow_| to us.
@@ -65,11 +63,12 @@ class UI_BASE_EXPORT SelectionRequestor {
private:
// A request that has been issued and we are waiting for a response to.
struct PendingRequest {
- explicit PendingRequest(Atom target);
+ PendingRequest(::Atom requested_selection, ::Atom requested_target);
~PendingRequest();
- // Data to the current XConvertSelection request. Used for error detection;
- // we verify it on the return message.
+ // The target and selection requested in the XConvertSelection() request.
+ // Used for error detection.
+ ::Atom selection;
::Atom target;
// Called to terminate the nested message loop.
@@ -85,6 +84,16 @@ class UI_BASE_EXPORT SelectionRequestor {
bool returned;
};
+ // Helper method for PerformBlockingConvertSelection() and
+ // PerformBlockingConvertSelectionWithParameter().
+ bool PerformBlockingConvertSelectionImpl(
+ ::Atom selection,
+ ::Atom target,
+ const char* property_name,
+ scoped_refptr<base::RefCountedMemory>* out_data,
+ size_t* out_data_items,
+ ::Atom* out_type);
+
// Blocks till SelectionNotify is received for the target specified in
// |request|.
void BlockTillSelectionNotifyForRequest(PendingRequest* request);
@@ -93,9 +102,6 @@ class UI_BASE_EXPORT SelectionRequestor {
Display* x_display_;
::Window x_window_;
- // The X11 selection that this instance communicates on.
- ::Atom selection_name_;
-
// Dispatcher which handles SelectionNotify and SelectionRequest for
// |selection_name_|. PerformBlockingConvertSelection() calls the
// dispatcher directly if PerformBlockingConvertSelection() is called after
@@ -103,6 +109,9 @@ class UI_BASE_EXPORT SelectionRequestor {
// Not owned.
PlatformEventDispatcher* dispatcher_;
+ // A pool of properties which can be used in XConvertSelection() requests.
+ std::list<const char*> property_pool_;
+
// A list of requests for which we are waiting for responses.
std::list<PendingRequest*> pending_requests_;

Powered by Google App Engine
This is Rietveld 408576698