diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 19:18:30 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 19:18:30 +0000 |
commit | 36808add2cec1c95898ddf6037040a5637e6e846 (patch) | |
tree | c8234c82029df45fa62841644cc2b22cacc73fb5 /chrome/gpu | |
parent | 38e13cb3da9cec27ae90430f7f9d95986ce3d90f (diff) | |
download | chromium_src-36808add2cec1c95898ddf6037040a5637e6e846.zip chromium_src-36808add2cec1c95898ddf6037040a5637e6e846.tar.gz chromium_src-36808add2cec1c95898ddf6037040a5637e6e846.tar.bz2 |
Revert 63232 - On Windows, create a new TransportDIB::Handle struct which includes the file
mapping HANDLE and the source process ID. Duplicating the handle for the
remote process is done in TransportDIB::Map, instead of in various #ifdefs
scattered across the code. Also on windows, remove the struct for the
TransportDIB::Id which contained both the sequence number and the HANDLE and
replace it with just the sequence number.
Fix ThumbnailGenerator by mapping the TransportDIB on Windows and adding
a method to duplicate the file mapping handle before sending across the
channel.
Also, add a ScopedHandle and fix some handle leaks.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3834003
TBR=kkania@chromium.org
Review URL: http://codereview.chromium.org/3943002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r-- | chrome/gpu/gpu_backing_store_glx.cc | 5 | ||||
-rw-r--r-- | chrome/gpu/gpu_backing_store_glx.h | 3 | ||||
-rw-r--r-- | chrome/gpu/gpu_backing_store_win.cc | 16 | ||||
-rw-r--r-- | chrome/gpu/gpu_backing_store_win.h | 3 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_layer_glx.cc | 6 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_layer_glx.h | 3 |
6 files changed, 26 insertions, 10 deletions
diff --git a/chrome/gpu/gpu_backing_store_glx.cc b/chrome/gpu/gpu_backing_store_glx.cc index ba5fa20..916a1db 100644 --- a/chrome/gpu/gpu_backing_store_glx.cc +++ b/chrome/gpu/gpu_backing_store_glx.cc @@ -60,10 +60,11 @@ void GpuBackingStoreGLX::OnChannelError() { } void GpuBackingStoreGLX::OnPaintToBackingStore( - TransportDIB::Handle dib_handle, + base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects) { - scoped_ptr<TransportDIB> dib(TransportDIB::Map(dib_handle)); + scoped_ptr<TransportDIB> dib(TransportDIB::Map(id)); view_->BindContext(); scoped_ptr<skia::PlatformCanvas> canvas( diff --git a/chrome/gpu/gpu_backing_store_glx.h b/chrome/gpu/gpu_backing_store_glx.h index af1ced5..14b1f5f 100644 --- a/chrome/gpu/gpu_backing_store_glx.h +++ b/chrome/gpu/gpu_backing_store_glx.h @@ -36,7 +36,8 @@ class GpuBackingStoreGLX : public IPC::Channel::Listener { private: // Message handlers. - void OnPaintToBackingStore(TransportDIB::Handle dib_handle, + void OnPaintToBackingStore(base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects); void OnScrollBackingStore(int dx, int dy, diff --git a/chrome/gpu/gpu_backing_store_win.cc b/chrome/gpu/gpu_backing_store_win.cc index 2b22369..d5af441 100644 --- a/chrome/gpu/gpu_backing_store_win.cc +++ b/chrome/gpu/gpu_backing_store_win.cc @@ -116,10 +116,21 @@ void GpuBackingStoreWin::OnChannelError() { } void GpuBackingStoreWin::OnPaintToBackingStore( - TransportDIB::Handle dib_handle, + base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects) { - scoped_ptr<TransportDIB> dib(TransportDIB::Map(dib_handle)); + HANDLE source_process_handle = OpenProcess(PROCESS_ALL_ACCESS, + FALSE, source_process_id); + CHECK(source_process_handle); + + // On Windows we need to duplicate the handle from the remote process. + // See BrowserRenderProcessHost::MapTransportDIB for how to do this on other + // platforms. + HANDLE section = win_util::GetSectionFromProcess( + id.handle, source_process_handle, false /* read write */); + CHECK(section); + scoped_ptr<TransportDIB> dib(TransportDIB::Map(section)); CHECK(dib.get()); if (!backing_store_dib_) { @@ -157,6 +168,7 @@ void GpuBackingStoreWin::OnPaintToBackingStore( view_->InvalidateRect(&paint_rect.ToRECT()); } + CloseHandle(source_process_handle); gpu_thread_->Send(new GpuHostMsg_PaintToBackingStore_ACK(routing_id_)); } diff --git a/chrome/gpu/gpu_backing_store_win.h b/chrome/gpu/gpu_backing_store_win.h index 2899e93..fc4bfd9 100644 --- a/chrome/gpu/gpu_backing_store_win.h +++ b/chrome/gpu/gpu_backing_store_win.h @@ -42,7 +42,8 @@ class GpuBackingStoreWin : public IPC::Channel::Listener { private: // Message handlers. - void OnPaintToBackingStore(TransportDIB::Handle dib_handle, + void OnPaintToBackingStore(base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect, const std::vector<gfx::Rect>& copy_rects); void OnScrollBackingStore(int dx, int dy, diff --git a/chrome/gpu/gpu_video_layer_glx.cc b/chrome/gpu/gpu_video_layer_glx.cc index dffa35e..d0578ad 100644 --- a/chrome/gpu/gpu_video_layer_glx.cc +++ b/chrome/gpu/gpu_video_layer_glx.cc @@ -251,9 +251,9 @@ void GpuVideoLayerGLX::OnChannelError() { NOTIMPLEMENTED(); } -void GpuVideoLayerGLX::OnPaintToVideoLayer(TransportDIB::Handle dib_handle, +void GpuVideoLayerGLX::OnPaintToVideoLayer(base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect) { - TransportDIB::ScopedHandle scoped_dib_handle(dib_handle); // TODO(scherkus): |native_size_| is set in constructor, so perhaps this check // should be a DCHECK(). const int width = native_size_.width(); @@ -264,7 +264,7 @@ void GpuVideoLayerGLX::OnPaintToVideoLayer(TransportDIB::Handle dib_handle, height <= 0 || height > kMaxVideoLayerSize) return; - TransportDIB* dib = TransportDIB::Map(scoped_dib_handle.release()); + TransportDIB* dib = TransportDIB::Map(id); if (!dib) return; diff --git a/chrome/gpu/gpu_video_layer_glx.h b/chrome/gpu/gpu_video_layer_glx.h index 89d00b1..4b3497f 100644 --- a/chrome/gpu/gpu_video_layer_glx.h +++ b/chrome/gpu/gpu_video_layer_glx.h @@ -40,7 +40,8 @@ class GpuVideoLayerGLX : public IPC::Channel::Listener { private: // Message handlers. - void OnPaintToVideoLayer(TransportDIB::Handle dib_handle, + void OnPaintToVideoLayer(base::ProcessId source_process_id, + TransportDIB::Id id, const gfx::Rect& bitmap_rect); // Calculates vertices for |object| relative to |world|, where |world| is |