OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/renderer_host/backing_store.h" | |
6 | |
7 #include <xcb/xcb.h> | |
8 | |
9 #include "base/logging.h" | |
10 #include "chrome/common/transport_dib.h" | |
11 | |
12 #ifdef NDEBUG | |
13 #define XCB_CALL(func, ...) func(__VA_ARGS__) | |
14 #else | |
15 #define XCB_CALL(func, ...) do { \ | |
16 xcb_void_cookie_t cookie = func##_checked(__VA_ARGS__); \ | |
17 xcb_generic_error_t* error = xcb_request_check(connection_, cookie); \ | |
18 if (error) { \ | |
19 CHECK(false) << "XCB error" \ | |
20 << " code:" << error->error_code \ | |
21 << " type:" << error->response_type \ | |
22 << " sequence:" << error->sequence; \ | |
23 } \ | |
24 } while(false); | |
25 #endif | |
26 | |
27 BackingStore::BackingStore(const gfx::Size& size, | |
28 xcb_connection_t* connection, | |
29 xcb_window_t window, | |
30 bool use_shared_memory) | |
31 : connection_(connection), | |
32 use_shared_memory_(use_shared_memory), | |
33 pixmap_(xcb_generate_id(connection)) { | |
34 XCB_CALL(xcb_create_pixmap, connection_, 32, pixmap, window, size.width(), | |
35 size.height()); | |
36 } | |
37 | |
38 BackingStore::~BackingStore() { | |
39 XCB_CALL(xcb_free_pixmap, pixmap_); | |
40 } | |
OLD | NEW |