summaryrefslogtreecommitdiffstats
path: root/chrome/common
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/common
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/common')
-rw-r--r--chrome/common/common_param_traits.h35
-rw-r--r--chrome/common/gpu_messages_internal.h11
-rw-r--r--chrome/common/render_messages_internal.h5
-rw-r--r--chrome/common/render_messages_params.cc16
-rw-r--r--chrome/common/render_messages_params.h9
5 files changed, 48 insertions, 28 deletions
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
index a2c5dca..27a86d1 100644
--- a/chrome/common/common_param_traits.h
+++ b/chrome/common/common_param_traits.h
@@ -12,6 +12,10 @@
#define CHROME_COMMON_COMMON_PARAM_TRAITS_H_
#pragma once
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
#include <vector>
#include "app/surface/transport_dib.h"
@@ -238,22 +242,33 @@ struct ParamTraits<webkit_glue::WebApplicationInfo> {
#if defined(OS_WIN)
-template<>
-struct ParamTraits<TransportDIB::Id> {
- typedef TransportDIB::Id param_type;
+template <>
+struct ParamTraits<TransportDIB::Handle> {
+ typedef TransportDIB::Handle param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.handle);
- WriteParam(m, p.sequence_num);
+ WriteParam(m, p.section());
+ WriteParam(m, p.owner_id());
+ WriteParam(m, p.should_dup_on_map());
}
static bool Read(const Message* m, void** iter, param_type* r) {
- return (ReadParam(m, iter, &r->handle) &&
- ReadParam(m, iter, &r->sequence_num));
+ HANDLE section;
+ base::ProcessId owner_id;
+ bool should_dup_on_map;
+ bool success = ReadParam(m, iter, &section) &&
+ ReadParam(m, iter, &owner_id) &&
+ ReadParam(m, iter, &should_dup_on_map);
+ if (success) {
+ *r = TransportDIB::Handle(section, owner_id, should_dup_on_map);
+ }
+ return success;
}
static void Log(const param_type& p, std::string* l) {
- l->append("TransportDIB(");
- LogParam(p.handle, l);
+ l->append("TransportDIB::Handle(");
+ LogParam(p.section(), l);
+ l->append(", ");
+ LogParam(p.owner_id(), l);
l->append(", ");
- LogParam(p.sequence_num, l);
+ LogParam(p.should_dup_on_map(), l);
l->append(")");
}
};
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 9a6896b..22ce601 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -72,13 +72,11 @@ IPC_BEGIN_MESSAGES(Gpu)
// Updates the backing store with the given bitmap. The GPU process will send
// back a GpuHostMsg_PaintToBackingStore_ACK after the paint is complete to
// let the caller know the TransportDIB can be freed or reused.
- IPC_MESSAGE_ROUTED4(GpuMsg_PaintToBackingStore,
- base::ProcessId, /* process */
- TransportDIB::Id, /* bitmap */
+ IPC_MESSAGE_ROUTED3(GpuMsg_PaintToBackingStore,
+ TransportDIB::Handle, /* bitmap_handle */
gfx::Rect, /* bitmap_rect */
std::vector<gfx::Rect>) /* copy_rects */
-
IPC_MESSAGE_ROUTED4(GpuMsg_ScrollBackingStore,
int, /* dx */
int, /* dy */
@@ -93,9 +91,8 @@ IPC_BEGIN_MESSAGES(Gpu)
// Updates the video layer with the given YUV data. The GPU process will send
// back a GpuHostMsg_PaintToVideoLayer_ACK after the paint is complete to
// let the caller know the TransportDIB can be freed or reused.
- IPC_MESSAGE_ROUTED3(GpuMsg_PaintToVideoLayer,
- base::ProcessId, /* process */
- TransportDIB::Id, /* bitmap */
+ IPC_MESSAGE_ROUTED2(GpuMsg_PaintToVideoLayer,
+ TransportDIB::Handle, /* bitmap_handle */
gfx::Rect) /* bitmap_rect */
IPC_END_MESSAGES(Gpu)
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index ae4ebcb..38f6332 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1259,8 +1259,9 @@ IPC_BEGIN_MESSAGES(ViewHost)
// Sent to create, update and destroy video layers.
IPC_MESSAGE_ROUTED1(ViewHostMsg_CreateVideo,
gfx::Size /* size */)
- IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateVideo,
- TransportDIB::Id /* bitmap */,
+ IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateVideo,
+ TransportDIB::Id /* bitmap_id */,
+ TransportDIB::Handle /* bitmap_handle */,
gfx::Rect /* bitmap_rect */)
IPC_MESSAGE_ROUTED0(ViewHostMsg_DestroyVideo)
diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc
index c5b4aa3..6f6b791 100644
--- a/chrome/common/render_messages_params.cc
+++ b/chrome/common/render_messages_params.cc
@@ -38,11 +38,11 @@ ViewHostMsg_FrameNavigate_Params::~ViewHostMsg_FrameNavigate_Params() {
}
ViewHostMsg_UpdateRect_Params::ViewHostMsg_UpdateRect_Params()
- : dx(0),
+ : dib_id(0),
+ dib_handle(TransportDIB::DefaultHandleValue()),
+ dx(0),
dy(0),
flags(0) {
- // On windows, bitmap is of type "struct HandleAndSequenceNum"
- memset(&bitmap, 0, sizeof(bitmap));
}
ViewHostMsg_UpdateRect_Params::~ViewHostMsg_UpdateRect_Params() {
@@ -799,7 +799,8 @@ void ParamTraits<ViewHostMsg_FrameNavigate_Params>::Log(const param_type& p,
void ParamTraits<ViewHostMsg_UpdateRect_Params>::Write(
Message* m, const param_type& p) {
- WriteParam(m, p.bitmap);
+ WriteParam(m, p.dib_id);
+ WriteParam(m, p.dib_handle);
WriteParam(m, p.bitmap_rect);
WriteParam(m, p.dx);
WriteParam(m, p.dy);
@@ -813,7 +814,8 @@ void ParamTraits<ViewHostMsg_UpdateRect_Params>::Write(
bool ParamTraits<ViewHostMsg_UpdateRect_Params>::Read(
const Message* m, void** iter, param_type* p) {
return
- ReadParam(m, iter, &p->bitmap) &&
+ ReadParam(m, iter, &p->dib_id) &&
+ ReadParam(m, iter, &p->dib_handle) &&
ReadParam(m, iter, &p->bitmap_rect) &&
ReadParam(m, iter, &p->dx) &&
ReadParam(m, iter, &p->dy) &&
@@ -827,7 +829,9 @@ bool ParamTraits<ViewHostMsg_UpdateRect_Params>::Read(
void ParamTraits<ViewHostMsg_UpdateRect_Params>::Log(const param_type& p,
std::string* l) {
l->append("(");
- LogParam(p.bitmap, l);
+ LogParam(p.dib_id, l);
+ l->append(", ");
+ LogParam(p.dib_handle, l);
l->append(", ");
LogParam(p.bitmap_rect, l);
l->append(", ");
diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h
index 2b0c0d0..7181b1b 100644
--- a/chrome/common/render_messages_params.h
+++ b/chrome/common/render_messages_params.h
@@ -285,9 +285,12 @@ struct ViewHostMsg_UpdateRect_Params {
ViewHostMsg_UpdateRect_Params();
~ViewHostMsg_UpdateRect_Params();
- // The bitmap to be painted into the view at the locations specified by
- // update_rects.
- TransportDIB::Id bitmap;
+ // The ID of the bitmap to be painted into the view at the locations specified
+ // by update_rects.
+ TransportDIB::Id dib_id;
+
+ // The handle to the bitmap, in case it needs to be mapped on the browser.
+ TransportDIB::Handle dib_handle;
// The position and size of the bitmap.
gfx::Rect bitmap_rect;