summaryrefslogtreecommitdiffstats
path: root/chrome/gpu
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 03:48:48 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 03:48:48 +0000
commit6d853d9e57b7c5415a8042165e8668cb76a0f9b7 (patch)
tree95ddb2260d74765da6604c68a8c486adbc4be1bc /chrome/gpu
parent71743c1a6912e07cb6c9fbe342d23f8b4a9f31c1 (diff)
downloadchromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.zip
chromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.tar.gz
chromium_src-6d853d9e57b7c5415a8042165e8668cb76a0f9b7.tar.bz2
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. BUG=none TEST=none Review URL: http://codereview.chromium.org/3305020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r--chrome/gpu/gpu_backing_store_glx.cc5
-rw-r--r--chrome/gpu/gpu_backing_store_glx.h3
-rw-r--r--chrome/gpu/gpu_backing_store_win.cc16
-rw-r--r--chrome/gpu/gpu_backing_store_win.h3
-rw-r--r--chrome/gpu/gpu_video_layer_glx.cc5
-rw-r--r--chrome/gpu/gpu_video_layer_glx.h3
6 files changed, 9 insertions, 26 deletions
diff --git a/chrome/gpu/gpu_backing_store_glx.cc b/chrome/gpu/gpu_backing_store_glx.cc
index 916a1db..ba5fa20 100644
--- a/chrome/gpu/gpu_backing_store_glx.cc
+++ b/chrome/gpu/gpu_backing_store_glx.cc
@@ -60,11 +60,10 @@ void GpuBackingStoreGLX::OnChannelError() {
}
void GpuBackingStoreGLX::OnPaintToBackingStore(
- base::ProcessId source_process_id,
- TransportDIB::Id id,
+ TransportDIB::Handle dib_handle,
const gfx::Rect& bitmap_rect,
const std::vector<gfx::Rect>& copy_rects) {
- scoped_ptr<TransportDIB> dib(TransportDIB::Map(id));
+ scoped_ptr<TransportDIB> dib(TransportDIB::Map(dib_handle));
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 14b1f5f..af1ced5 100644
--- a/chrome/gpu/gpu_backing_store_glx.h
+++ b/chrome/gpu/gpu_backing_store_glx.h
@@ -36,8 +36,7 @@ class GpuBackingStoreGLX : public IPC::Channel::Listener {
private:
// Message handlers.
- void OnPaintToBackingStore(base::ProcessId source_process_id,
- TransportDIB::Id id,
+ void OnPaintToBackingStore(TransportDIB::Handle dib_handle,
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 d5af441..2b22369 100644
--- a/chrome/gpu/gpu_backing_store_win.cc
+++ b/chrome/gpu/gpu_backing_store_win.cc
@@ -116,21 +116,10 @@ void GpuBackingStoreWin::OnChannelError() {
}
void GpuBackingStoreWin::OnPaintToBackingStore(
- base::ProcessId source_process_id,
- TransportDIB::Id id,
+ TransportDIB::Handle dib_handle,
const gfx::Rect& bitmap_rect,
const std::vector<gfx::Rect>& copy_rects) {
- 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));
+ scoped_ptr<TransportDIB> dib(TransportDIB::Map(dib_handle));
CHECK(dib.get());
if (!backing_store_dib_) {
@@ -168,7 +157,6 @@ 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 fc4bfd9..2899e93 100644
--- a/chrome/gpu/gpu_backing_store_win.h
+++ b/chrome/gpu/gpu_backing_store_win.h
@@ -42,8 +42,7 @@ class GpuBackingStoreWin : public IPC::Channel::Listener {
private:
// Message handlers.
- void OnPaintToBackingStore(base::ProcessId source_process_id,
- TransportDIB::Id id,
+ void OnPaintToBackingStore(TransportDIB::Handle dib_handle,
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 d0578ad..a90b387 100644
--- a/chrome/gpu/gpu_video_layer_glx.cc
+++ b/chrome/gpu/gpu_video_layer_glx.cc
@@ -251,8 +251,7 @@ void GpuVideoLayerGLX::OnChannelError() {
NOTIMPLEMENTED();
}
-void GpuVideoLayerGLX::OnPaintToVideoLayer(base::ProcessId source_process_id,
- TransportDIB::Id id,
+void GpuVideoLayerGLX::OnPaintToVideoLayer(TransportDIB::Handle dib_handle,
const gfx::Rect& bitmap_rect) {
// TODO(scherkus): |native_size_| is set in constructor, so perhaps this check
// should be a DCHECK().
@@ -264,7 +263,7 @@ void GpuVideoLayerGLX::OnPaintToVideoLayer(base::ProcessId source_process_id,
height <= 0 || height > kMaxVideoLayerSize)
return;
- TransportDIB* dib = TransportDIB::Map(id);
+ TransportDIB* dib = TransportDIB::Map(dib_handle);
if (!dib)
return;
diff --git a/chrome/gpu/gpu_video_layer_glx.h b/chrome/gpu/gpu_video_layer_glx.h
index 4b3497f..89d00b1 100644
--- a/chrome/gpu/gpu_video_layer_glx.h
+++ b/chrome/gpu/gpu_video_layer_glx.h
@@ -40,8 +40,7 @@ class GpuVideoLayerGLX : public IPC::Channel::Listener {
private:
// Message handlers.
- void OnPaintToVideoLayer(base::ProcessId source_process_id,
- TransportDIB::Id id,
+ void OnPaintToVideoLayer(TransportDIB::Handle dib_handle,
const gfx::Rect& bitmap_rect);
// Calculates vertices for |object| relative to |world|, where |world| is