diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 21:41:02 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 21:41:02 +0000 |
commit | 67a46b7f6da205b7a1e772b7383bb20bab8ca611 (patch) | |
tree | 6345ab0ffb453906e3e4f8f87514b1e21649e6b6 /chrome/common | |
parent | 3cc848c2747c8bc2ecede8e8df4eeb343d3d8988 (diff) | |
download | chromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.zip chromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.tar.gz chromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.tar.bz2 |
Adds kind-of-live thumbnail generation for a potential tab switcher.
This listens to tab events and tries to keep thumbnails ready to go. See
thumbnail_generator.cc for a more detailed design.
This adds a painting observer to the RenderWidgetHost to enable this new
behavior, as well as a notification to allow the thumbnail generator to hook
its observer in. There is also a new notification that a backing store has been
disabled, which required making the backing stores know about their owning
widget hosts.
This component is currently disabled. We just need to uncomment the member in
Profile and it will start to work.
Original review: http://codereview.chromium.org/118420
Review URL: http://codereview.chromium.org/126101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/notification_type.h | 11 | ||||
-rw-r--r-- | chrome/common/property_bag.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/common/transport_dib.h | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/common/transport_dib_linux.cc | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/common/transport_dib_mac.cc | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/common/transport_dib_win.cc | 5 |
6 files changed, 37 insertions, 1 deletions
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 3c8b26a..678c942 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -286,6 +286,12 @@ class NotificationType { // Source<TabContents>. TAB_CONTENTS_DESTROYED, + // A RenderViewHost was created for a TabContents. The source is the + // RenderViewHostManager who owns it, and the details is the RenderViewHost + // pointer. Note that the source will be NULL in some cases for testing, + // when there is no RVHManager. + RENDER_VIEW_HOST_CREATED_FOR_TAB, + // Stuff inside the tabs --------------------------------------------------- // This message is sent after a constrained window has been closed. The @@ -326,6 +332,11 @@ class NotificationType { // the RenderWidgetHost, the details are not used. RENDER_WIDGET_HOST_DESTROYED, + // Indicates a RenderWidgetHost has been hidden or restored. The source is + // the RWH whose visibility changed, the details is a bool set to true if + // the new state is "visible." + RENDER_WIDGET_VISIBILITY_CHANGED, + // Notification from TabContents that we have received a response from the // renderer after using the dom inspector. DOM_INSPECT_ELEMENT_RESPONSE, diff --git a/chrome/common/property_bag.h b/chrome/common/property_bag.h index d2f3559..afc7bd3 100644 --- a/chrome/common/property_bag.h +++ b/chrome/common/property_bag.h @@ -131,7 +131,7 @@ class PropertyAccessor : public PropertyAccessorBase { PropertyAccessor() : PropertyAccessorBase() {} virtual ~PropertyAccessor() {} - // Takes ownership of the |prop| pointer. + // Makes a copy of the |prop| object for storage. void SetProperty(PropertyBag* bag, const T& prop) { SetPropertyInternal(bag, new Container(prop)); } diff --git a/chrome/common/transport_dib.h b/chrome/common/transport_dib.h index 33c0649..5712827 100644..100755 --- a/chrome/common/transport_dib.h +++ b/chrome/common/transport_dib.h @@ -20,6 +20,9 @@ namespace gfx { class Size; } +namespace skia { +class PlatformCanvas; +} // ----------------------------------------------------------------------------- // A TransportDIB is a block of memory that is used to transport pixels @@ -84,6 +87,11 @@ class TransportDIB { // Map the referenced transport DIB. Returns NULL on failure. static TransportDIB* Map(Handle transport_dib); + // Returns a canvas using the memory of this TransportDIB. The returned + // pointer will be owned by the caller. The bitmap will be of the given size, + // which should fit inside this memory. + skia::PlatformCanvas* GetPlatformCanvas(int w, int h); + // Return a pointer to the shared memory void* memory() const; diff --git a/chrome/common/transport_dib_linux.cc b/chrome/common/transport_dib_linux.cc index be673d9..1037341 100644..100755 --- a/chrome/common/transport_dib_linux.cc +++ b/chrome/common/transport_dib_linux.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "chrome/common/transport_dib.h" #include "chrome/common/x11_util.h" +#include "skia/ext/platform_canvas.h" // The shmat system call uses this as it's invalid return address static void *const kInvalidAddress = (void*) -1; @@ -80,6 +81,11 @@ TransportDIB* TransportDIB::Map(Handle shmkey) { return dib; } +skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { + return new skia::PlatformCanvas(w, h, true, + reinterpret_cast<uint8_t*>(memory())); +} + void* TransportDIB::memory() const { DCHECK_NE(address_, kInvalidAddress); return address_; diff --git a/chrome/common/transport_dib_mac.cc b/chrome/common/transport_dib_mac.cc index b4c7a2a7..638866c 100644..100755 --- a/chrome/common/transport_dib_mac.cc +++ b/chrome/common/transport_dib_mac.cc @@ -9,6 +9,7 @@ #include "base/eintr_wrapper.h" #include "base/shared_memory.h" +#include "skia/ext/platform_canvas.h" TransportDIB::TransportDIB() : size_(0) { @@ -52,6 +53,11 @@ TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { return dib; } +skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { + return new skia::PlatformCanvas(w, h, true, + reinterpret_cast<uint8_t*>(dib->memory())); +} + void* TransportDIB::memory() const { return shared_memory_.memory(); } diff --git a/chrome/common/transport_dib_win.cc b/chrome/common/transport_dib_win.cc index 49cb755..41fe925 100644..100755 --- a/chrome/common/transport_dib_win.cc +++ b/chrome/common/transport_dib_win.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/sys_info.h" #include "chrome/common/transport_dib.h" +#include "skia/ext/platform_canvas.h" TransportDIB::TransportDIB() { } @@ -59,6 +60,10 @@ TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) { return dib; } +skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { + return new skia::PlatformCanvas(w, h, true, handle()); +} + void* TransportDIB::memory() const { return shared_memory_.memory(); } |