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

Issue 2177823002: X11: Add window cache

Created:
4 years, 5 months ago by Tom (Use chromium acct)
Modified:
4 years, 2 months ago
CC:
chromium-reviews, sadrul, yusukes+watch_chromium.org, derat+watch_chromium.org, grt+watch_chromium.org, wfh+watch_chromium.org, Michael Moss
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Patch Set 1 #

Patch Set 2 : Refactor and add unit tests #

Patch Set 3 : Remove changes from dependent patchset #

Total comments: 6

Patch Set 4 : Refactor #

Total comments: 13

Patch Set 5 : Move Request code to source file #

Patch Set 6 : Reset when in a bad state & handle EINTR #

Patch Set 7 : Don't open another xcb_connection #

Patch Set 8 : Fix test compilation #

Total comments: 5

Patch Set 9 : Fix API #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1717 lines, -5 lines) Patch
M ui/base/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M ui/base/x/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +18 lines, -0 lines 0 comments Download
A ui/base/x/x11_window_cache.h View 1 2 3 4 5 6 7 8 1 chunk +228 lines, -0 lines 0 comments Download
A ui/base/x/x11_window_cache.cc View 1 2 3 4 5 6 7 8 1 chunk +731 lines, -0 lines 0 comments Download
A ui/base/x/x11_window_cache_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +551 lines, -0 lines 0 comments Download
M ui/events/platform/x11/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M ui/events/platform/x11/x11_event_source.h View 1 2 3 4 5 6 7 8 5 chunks +60 lines, -0 lines 0 comments Download
M ui/events/platform/x11/x11_event_source.cc View 1 2 3 4 5 6 7 8 7 chunks +125 lines, -4 lines 0 comments Download

Messages

Total messages: 43 (24 generated)
Tom (Use chromium acct)
https://codereview.chromium.org/2177823002/diff/40001/ui/base/x/x11_window_cache.cc File ui/base/x/x11_window_cache.cc (right): https://codereview.chromium.org/2177823002/diff/40001/ui/base/x/x11_window_cache.cc#newcode220 ui/base/x/x11_window_cache.cc:220: void XWindowCache::PrintWindowTreeForTestingAux(Window* window, This was useful when developing, but ...
4 years, 4 months ago (2016-07-26 20:17:43 UTC) #3
Tom (Use chromium acct)
Ping. sadrul@ for OWNERS approval + erg@ and danakj@ (I know you're currently OOO) for ...
4 years, 4 months ago (2016-08-06 00:38:17 UTC) #6
Daniel Erat
please write a design doc for this change, if there isn't one already. https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc File ...
4 years, 4 months ago (2016-08-06 00:49:22 UTC) #9
Tom (Use chromium acct)
On 2016/08/06 00:49:22, Daniel Erat wrote: > please write a design doc for this change, ...
4 years, 4 months ago (2016-08-06 01:29:27 UTC) #10
Elliot Glaysher
https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc File ui/base/x/x11_window_cache.cc (right): https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc#newcode244 ui/base/x/x11_window_cache.cc:244: // TODO(thomasanderson): should we handle EAGAIN? I suspect that ...
4 years, 4 months ago (2016-08-08 18:17:29 UTC) #11
Tom (Use chromium acct)
On 2016/08/06 00:49:22, Daniel Erat wrote: > please write a design doc for this change, ...
4 years, 4 months ago (2016-08-08 21:25:56 UTC) #13
Daniel Erat
thanks! mind granting permission to leave comments? it looks like i currently can't leave comments ...
4 years, 4 months ago (2016-08-08 21:46:48 UTC) #14
Tom (Use chromium acct)
On 2016/08/08 21:46:48, Daniel Erat wrote: > thanks! mind granting permission to leave comments? it ...
4 years, 4 months ago (2016-08-08 21:52:50 UTC) #15
Tom (Use chromium acct)
https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc File ui/base/x/x11_window_cache.cc (right): https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc#newcode209 ui/base/x/x11_window_cache.cc:209: connection_ = xcb_connect(DisplayString(display), nullptr); On 2016/08/06 00:49:22, Daniel Erat ...
4 years, 4 months ago (2016-08-08 23:23:38 UTC) #16
danakj
https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache_unittest.cc File ui/base/x/x11_window_cache_unittest.cc (right): https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache_unittest.cc#newcode16 ui/base/x/x11_window_cache_unittest.cc:16: class XWindowCacheTest : public testing::Test { On 2016/08/08 23:23:38, ...
4 years, 4 months ago (2016-08-09 22:18:45 UTC) #17
Tom (Use chromium acct)
https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc File ui/base/x/x11_window_cache.cc (right): https://codereview.chromium.org/2177823002/diff/80001/ui/base/x/x11_window_cache.cc#newcode244 ui/base/x/x11_window_cache.cc:244: // TODO(thomasanderson): should we handle EAGAIN? On 2016/08/08 23:23:38, ...
4 years, 4 months ago (2016-08-15 19:57:00 UTC) #18
Tom (Use chromium acct)
I've decided that derat@ is right and it's better to use the main XDisplay for ...
4 years, 3 months ago (2016-08-29 22:46:23 UTC) #19
danakj
On Mon, Aug 29, 2016 at 3:46 PM, <thomasanderson@google.com> wrote: > I've decided that derat@ ...
4 years, 3 months ago (2016-08-29 22:58:13 UTC) #20
Tom (Use chromium acct)
On 2016/08/29 22:58:13, danakj wrote: > On Mon, Aug 29, 2016 at 3:46 PM, <mailto:thomasanderson@google.com> ...
4 years, 3 months ago (2016-08-29 23:06:54 UTC) #21
Tom (Use chromium acct)
Pinging reviewers Since the last update, I've refactored this CL so that we don't have ...
4 years, 3 months ago (2016-09-06 19:56:08 UTC) #33
Daniel Erat
some high-level comments https://codereview.chromium.org/2177823002/diff/220001/ui/base/x/x11_window_cache.cc File ui/base/x/x11_window_cache.cc (right): https://codereview.chromium.org/2177823002/diff/220001/ui/base/x/x11_window_cache.cc#newcode582 ui/base/x/x11_window_cache.cc:582: windows_.erase(id); are you leaking Window objects ...
4 years, 3 months ago (2016-09-06 20:35:59 UTC) #34
Tom (Use chromium acct)
On 2016/09/06 20:35:59, Daniel Erat wrote: > some high-level comments > > https://codereview.chromium.org/2177823002/diff/220001/ui/base/x/x11_window_cache.cc > File ...
4 years, 3 months ago (2016-09-06 21:09:50 UTC) #35
Tom (Use chromium acct)
derat@ I've fixed the API, PTAL
4 years, 2 months ago (2016-10-20 02:01:18 UTC) #40
Daniel Erat
4 years, 2 months ago (2016-10-20 17:30:54 UTC) #43
On 2016/10/20 02:01:18, Tom Anderson wrote:
> derat@ I've fixed the API, PTAL

it feels like the implementation is still spread across XWindowCache and its
nested classes in a way that feels a bit confusing to me. for example, Property
reaches into XWindowCache directly, while GetPropertyRequest reaches into
Property (and also XWindowCache) directly:

 554 XWindowCache::Property::Property(xcb_atom_t name,
 555                                  Window* window,
 556                                  XWindowCache* cache)
 557     : name_(name), property_request_(nullptr), data_(nullptr),
cache_(cache) {
 558   cache->event_source_->EnqueueRequest(
 559       new GetPropertyRequest(window, this, name, cache));
 560   xcb_flush(cache->connection_);
 561 }
 562 
 563 XWindowCache::Property::~Property() {
 564   if (property_request_)
 565     cache_->event_source_->DiscardRequest(property_request_);
 566 
 567   delete[] data_;
 568 }
 569 
 570 bool XWindowCache::Property::Validate() {
 571   return (!property_request_ ||
 572           cache_->event_source_->DispatchRequestNow(property_request_));
 573 }

...

 191 struct XWindowCache::GetPropertyRequest : public X11EventSource::Request {
...
 211   void OnReply(xcb_generic_reply_t* r, xcb_generic_error_t* error) override
{
...
 237     property_->property_request_ = nullptr;
 238     property_->type_ = reply->type;
 239     DCHECK(reply->format == 8 || reply->format == 16 || reply->format ==
32);
 240     property_->format_ = reply->format;
 241     property_->length_ = xcb_get_property_value_length(reply);
 242     uint32_t data_bytes = property_->length_ * (property_->format_ / 8);
 243     property_->data_ = new uint8_t[data_bytes];
 244     std::memcpy(property_->data_, xcb_get_property_value(reply),
data_bytes);
 245   }

i think i was trying to suggest earlier that all of the implementation live in
XWindowCache (and its hidden *Request classes), so that Property and Window are
just structs that contain public data members and no methods.

is there a reason why something like that wouldn't work? it seems like it'd be
much easier to follow:

- XWindowCache creates and enqueues requests itself
- XWindowCache owns Property and Window objects
- requests update Property and Window objects

Powered by Google App Engine
This is Rietveld 408576698