OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 host_render_view_routing_id_(host_render_view_routing_id), | 68 host_render_view_routing_id_(host_render_view_routing_id), |
69 weak_factory_(this) { | 69 weak_factory_(this) { |
70 #if defined(USE_X11) | 70 #if defined(USE_X11) |
71 windowless_shm_pixmaps_[0] = None; | 71 windowless_shm_pixmaps_[0] = None; |
72 windowless_shm_pixmaps_[1] = None; | 72 windowless_shm_pixmaps_[1] = None; |
73 use_shm_pixmap_ = false; | 73 use_shm_pixmap_ = false; |
74 | 74 |
75 // If the X server supports SHM pixmaps | 75 // If the X server supports SHM pixmaps |
76 // and the color depth and masks match, | 76 // and the color depth and masks match, |
77 // then consider using SHM pixmaps for windowless plugin painting. | 77 // then consider using SHM pixmaps for windowless plugin painting. |
78 Display* display = ui::GetXDisplay(); | 78 XDisplay* display = gfx::GetXDisplay(); |
79 if (ui::QuerySharedMemorySupport(display) == ui::SHARED_MEMORY_PIXMAP && | 79 if (ui::QuerySharedMemorySupport(display) == ui::SHARED_MEMORY_PIXMAP && |
80 ui::BitsPerPixelForPixmapDepth( | 80 ui::BitsPerPixelForPixmapDepth( |
81 display, DefaultDepth(display, DefaultScreen(display))) == 32) { | 81 display, DefaultDepth(display, DefaultScreen(display))) == 32) { |
82 Visual* vis = DefaultVisual(display, DefaultScreen(display)); | 82 Visual* vis = DefaultVisual(display, DefaultScreen(display)); |
83 | 83 |
84 if (vis->red_mask == 0xff0000 && | 84 if (vis->red_mask == 0xff0000 && |
85 vis->green_mask == 0xff00 && | 85 vis->green_mask == 0xff00 && |
86 vis->blue_mask == 0xff) | 86 vis->blue_mask == 0xff) |
87 use_shm_pixmap_ = true; | 87 use_shm_pixmap_ = true; |
88 } | 88 } |
89 #endif | 89 #endif |
90 } | 90 } |
91 | 91 |
92 WebPluginProxy::~WebPluginProxy() { | 92 WebPluginProxy::~WebPluginProxy() { |
93 #if defined(USE_X11) | 93 #if defined(USE_X11) |
94 if (windowless_shm_pixmaps_[0] != None) | 94 if (windowless_shm_pixmaps_[0] != None) |
95 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[0]); | 95 XFreePixmap(gfx::GetXDisplay(), windowless_shm_pixmaps_[0]); |
96 if (windowless_shm_pixmaps_[1] != None) | 96 if (windowless_shm_pixmaps_[1] != None) |
97 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[1]); | 97 XFreePixmap(gfx::GetXDisplay(), windowless_shm_pixmaps_[1]); |
98 #endif | 98 #endif |
99 | 99 |
100 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
101 // Destroy the surface early, since it may send messages during cleanup. | 101 // Destroy the surface early, since it may send messages during cleanup. |
102 if (accelerated_surface_) | 102 if (accelerated_surface_) |
103 accelerated_surface_.reset(); | 103 accelerated_surface_.reset(); |
104 #endif | 104 #endif |
105 | 105 |
106 if (plugin_element_) | 106 if (plugin_element_) |
107 WebBindings::releaseObject(plugin_element_); | 107 WebBindings::releaseObject(plugin_element_); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 canvas->clear(); | 550 canvas->clear(); |
551 } | 551 } |
552 *dib_out = new SharedTransportDIB(dib); | 552 *dib_out = new SharedTransportDIB(dib); |
553 } | 553 } |
554 | 554 |
555 void WebPluginProxy::CreateShmPixmapFromDIB( | 555 void WebPluginProxy::CreateShmPixmapFromDIB( |
556 TransportDIB* dib, | 556 TransportDIB* dib, |
557 const gfx::Rect& window_rect, | 557 const gfx::Rect& window_rect, |
558 XID* pixmap_out) { | 558 XID* pixmap_out) { |
559 if (dib) { | 559 if (dib) { |
560 Display* display = ui::GetXDisplay(); | 560 XDisplay* display = gfx::GetXDisplay(); |
561 XID root_window = ui::GetX11RootWindow(); | 561 XID root_window = ui::GetX11RootWindow(); |
562 XShmSegmentInfo shminfo = {0}; | 562 XShmSegmentInfo shminfo = {0}; |
563 | 563 |
564 if (*pixmap_out != None) | 564 if (*pixmap_out != None) |
565 XFreePixmap(display, *pixmap_out); | 565 XFreePixmap(display, *pixmap_out); |
566 | 566 |
567 shminfo.shmseg = dib->MapToX(display); | 567 shminfo.shmseg = dib->MapToX(display); |
568 // Create a shared memory pixmap based on the image buffer. | 568 // Create a shared memory pixmap based on the image buffer. |
569 *pixmap_out = XShmCreatePixmap(display, root_window, | 569 *pixmap_out = XShmCreatePixmap(display, root_window, |
570 NULL, &shminfo, | 570 NULL, &shminfo, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 int input_type; | 717 int input_type; |
718 gfx::Rect caret_rect; | 718 gfx::Rect caret_rect; |
719 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 719 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
720 return; | 720 return; |
721 | 721 |
722 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 722 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
723 } | 723 } |
724 #endif | 724 #endif |
725 | 725 |
726 } // namespace content | 726 } // namespace content |
OLD | NEW |