Changeset 58199 in webkit


Ignore:
Timestamp:
Apr 23, 2010 5:02:16 PM (14 years ago)
Author:
weinig@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=38065
Merge mac and win DrawingAreaProxyUpdateChunk implementations.

Reviewed by Anders Carlsson.

  • UIProcess/API/mac/WKView.mm:

(-[WKView drawRect:]):

  • UIProcess/DrawingAreaProxy.cpp: Copied from UIProcess/mac/DrawingAreaProxy.mm.
  • UIProcess/DrawingAreaProxy.h: Copied from UIProcess/mac/DrawingAreaProxy.h.
  • UIProcess/DrawingAreaProxyUpdateChunk.cpp: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm.

(WebKit::DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk):
(WebKit::DrawingAreaProxyUpdateChunk::paint):
(WebKit::DrawingAreaProxyUpdateChunk::setSize):
(WebKit::DrawingAreaProxyUpdateChunk::didSetSize):
(WebKit::DrawingAreaProxyUpdateChunk::update):
(WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage):

  • UIProcess/DrawingAreaProxyUpdateChunk.h: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.h.
  • UIProcess/mac/DrawingAreaProxy.h: Removed.
  • UIProcess/mac/DrawingAreaProxy.mm: Removed.
  • UIProcess/mac/DrawingAreaProxyUpdateChunk.h: Removed.
  • UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: Removed.
  • UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm.

(WebKit::DrawingAreaProxyUpdateChunk::page):
(WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore):
(WebKit::DrawingAreaProxyUpdateChunk::platformPaint):
(WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):

  • UIProcess/win/DrawingAreaProxy.cpp: Removed.
  • UIProcess/win/DrawingAreaProxy.h: Removed.
  • UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: Copied from UIProcess/win/DrawingAreaProxy.cpp.

(WebKit::DrawingAreaProxyUpdateChunk::page):
(WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore):
(WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore):
(WebKit::DrawingAreaProxyUpdateChunk::platformPaint):
(WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):

  • UIProcess/win/WebView.cpp:

(WebKit::WebView::WebView):
(WebKit::WebView::onPaintEvent):

  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
Location:
trunk/WebKit2
Files:
1 deleted
5 edited
1 copied
5 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r58189 r58199  
    33        Reviewed by Anders Carlsson.
    44
     5        https://bugs.webkit.org/show_bug.cgi?id=38065
     6        Merge mac and win DrawingAreaProxyUpdateChunk implementations.
     7
     8        * UIProcess/API/mac/WKView.mm:
     9        (-[WKView drawRect:]):
     10        * UIProcess/DrawingAreaProxy.cpp: Copied from UIProcess/mac/DrawingAreaProxy.mm.
     11        * UIProcess/DrawingAreaProxy.h: Copied from UIProcess/mac/DrawingAreaProxy.h.
     12        * UIProcess/DrawingAreaProxyUpdateChunk.cpp: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm.
     13        (WebKit::DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk):
     14        (WebKit::DrawingAreaProxyUpdateChunk::paint):
     15        (WebKit::DrawingAreaProxyUpdateChunk::setSize):
     16        (WebKit::DrawingAreaProxyUpdateChunk::didSetSize):
     17        (WebKit::DrawingAreaProxyUpdateChunk::update):
     18        (WebKit::DrawingAreaProxyUpdateChunk::didReceiveMessage):
     19        * UIProcess/DrawingAreaProxyUpdateChunk.h: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.h.
     20        * UIProcess/mac/DrawingAreaProxy.h: Removed.
     21        * UIProcess/mac/DrawingAreaProxy.mm: Removed.
     22        * UIProcess/mac/DrawingAreaProxyUpdateChunk.h: Removed.
     23        * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: Removed.
     24        * UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm: Copied from UIProcess/mac/DrawingAreaProxyUpdateChunk.mm.
     25        (WebKit::DrawingAreaProxyUpdateChunk::page):
     26        (WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore):
     27        (WebKit::DrawingAreaProxyUpdateChunk::platformPaint):
     28        (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):
     29        * UIProcess/win/DrawingAreaProxy.cpp: Removed.
     30        * UIProcess/win/DrawingAreaProxy.h: Removed.
     31        * UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp: Copied from UIProcess/win/DrawingAreaProxy.cpp.
     32        (WebKit::DrawingAreaProxyUpdateChunk::page):
     33        (WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore):
     34        (WebKit::DrawingAreaProxyUpdateChunk::invalidateBackingStore):
     35        (WebKit::DrawingAreaProxyUpdateChunk::platformPaint):
     36        (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):
     37        * UIProcess/win/WebView.cpp:
     38        (WebKit::WebView::WebView):
     39        (WebKit::WebView::onPaintEvent):
     40        * WebKit2.xcodeproj/project.pbxproj:
     41        * win/WebKit2.vcproj:
     42
     432010-04-23  Sam Weinig  <sam@webkit.org>
     44
     45        Reviewed by Anders Carlsson.
     46
    547        Fix for https://bugs.webkit.org/show_bug.cgi?id=38059
    6         Merge mac and win DrawingAreaUpdateChunk implementation.
     48        Merge mac and win DrawingAreaUpdateChunk implementations.
    749
    850        * UIProcess/win/DrawingAreaProxy.cpp:
  • trunk/WebKit2/UIProcess/API/mac/WKView.mm

    r57310 r58199  
    2828// C API
    2929#import "WKAPICast.h"
    30 #import "WKPage.h"
    3130
    3231// Implementation
     
    4241#import "WebProcessProxy.h"
    4342#import <QuartzCore/QuartzCore.h>
    44 #import <WebCore/IntSize.h>
     43#import <WebCore/IntRect.h>
    4544#import <wtf/RefPtr.h>
    4645
     
    250249    if (_data->_page->isValid() && _data->_page->drawingArea()) {
    251250        CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
    252         _data->_page->drawingArea()->drawRectIntoContext(NSRectToCGRect(rect), context);
     251        _data->_page->drawingArea()->paint(IntRect(rect), context);
    253252    }
    254253}
  • trunk/WebKit2/UIProcess/DrawingAreaProxy.cpp

    r58184 r58199  
    2424 */
    2525
    26 #import "DrawingAreaProxy.h"
     26#include "DrawingAreaProxy.h"
    2727
    2828namespace WebKit {
  • trunk/WebKit2/UIProcess/DrawingAreaProxy.h

    r58184 r58199  
    3737namespace WebCore {
    3838    class IntSize;
     39    class IntRect;
    3940}
    4041
     
    4950    virtual ~DrawingAreaProxy();
    5051
    51     virtual void drawRectIntoContext(CGRect, CGContextRef) = 0;
     52    virtual void paint(const WebCore::IntRect&, CGContextRef) = 0;
    5253    virtual void setSize(const WebCore::IntSize&) = 0;
    5354
  • trunk/WebKit2/UIProcess/DrawingAreaProxyUpdateChunk.cpp

    r58184 r58199  
    2424 */
    2525
    26 #import "DrawingAreaProxyUpdateChunk.h"
     26#include "DrawingAreaProxyUpdateChunk.h"
    2727
    28 #import "MessageID.h"
    29 
    30 #import "DrawingAreaMessageKinds.h"
    31 #import "DrawingAreaProxyMessageKinds.h"
    32 #import "WKView.h"
    33 #import "UpdateChunk.h"
    34 #import "WKAPICast.h"
    35 #import "WebCoreTypeArgumentMarshalling.h"
    36 #import "WebPageProxy.h"
    37 #import "WebProcessProxy.h"
     28#include "DrawingAreaMessageKinds.h"
     29#include "DrawingAreaProxyMessageKinds.h"
     30#include "MessageID.h"
     31#include "UpdateChunk.h"
     32#include "WebCoreTypeArgumentMarshalling.h"
     33#include "WebPageProxy.h"
     34#include "WebProcessProxy.h"
    3835
    3936using namespace WebCore;
     
    4138namespace WebKit {
    4239
    43 DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk(WKView* webView)
     40DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk(PlatformWebView* webView)
    4441    : DrawingAreaProxy(DrawingAreaUpdateChunkType)
    45     , m_isInitialized(false)
    4642    , m_isWaitingForDidSetFrameNotification(false)
    4743    , m_webView(webView)
     
    5349}
    5450
    55 void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect rect, CGContextRef context)
     51void DrawingAreaProxyUpdateChunk::paint(const IntRect& rect, PlatformDrawingContext context)
    5652{
    57     if (!m_isInitialized) {
    58         setSize(IntSize([m_webView frame].size));
    59         m_isInitialized = true;
    60     }
    61 
    6253    if (m_isWaitingForDidSetFrameNotification) {
    63         WebPageProxy* page = toWK([m_webView pageRef]);
     54        WebPageProxy* page = this->page();
    6455        if (!page->isValid())
    6556            return;
     
    7061    }
    7162
    72     if (!m_bitmapContext)
    73         return;
    74 
    75     RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(m_bitmapContext.get()));
    76     CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())), image.get());
    77 }
    78 
    79 void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
    80 {
    81     ensureBackingStore();
    82 
    83     RetainPtr<CGImageRef> image(updateChunk->createImage());
    84     const IntRect& updateChunkRect = updateChunk->rect();
    85    
    86     CGContextDrawImage(m_bitmapContext.get(), CGRectMake(updateChunkRect.x(), m_viewSize.height() - updateChunkRect.bottom(),
    87                                                          updateChunkRect.width(), updateChunkRect.height()), image.get());
    88     [m_webView setNeedsDisplayInRect:NSRectFromCGRect(updateChunkRect)];
    89 }
    90 
    91 void DrawingAreaProxyUpdateChunk::ensureBackingStore()
    92 {
    93     if (m_bitmapContext)
    94         return;
    95 
    96     RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    97     m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_viewSize.width(), m_viewSize.height(), 8, m_viewSize.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedLast));
    98    
    99     // Flip the bitmap context coordinate system.
    100     CGContextTranslateCTM(m_bitmapContext.get(), 0, m_viewSize.height());
    101     CGContextScaleCTM(m_bitmapContext.get(), 1, -1);
     63    platformPaint(rect, context);
    10264}
    10365
    10466void DrawingAreaProxyUpdateChunk::setSize(const IntSize& viewSize)
    10567{
    106     m_isInitialized = true;
     68    WebPageProxy* page = this->page();
     69    if (!page->isValid())
     70        return;
    10771
    108     WebPageProxy* page = toWK([m_webView pageRef]);
    109     if (!page->isValid())
     72    if (viewSize.isEmpty())
    11073        return;
    11174
    11275    m_viewSize = viewSize;
    11376    m_lastSetViewSize = viewSize;
    114    
     77
    11578    if (m_isWaitingForDidSetFrameNotification)
    11679        return;
    11780    m_isWaitingForDidSetFrameNotification = true;
    118    
     81
    11982    page->process()->responsivenessTimer()->start();
    12083    page->process()->connection()->send(DrawingAreaMessage::SetSize, page->pageID(), CoreIPC::In(viewSize));
     
    13194        setSize(m_lastSetViewSize);
    13295
    133     // Invalidate the backing store.
    134     m_bitmapContext = 0;
     96    invalidateBackingStore();
    13597    drawUpdateChunkIntoBackingStore(updateChunk);
    13698
    137     WebPageProxy* page = toWK([m_webView pageRef]);
     99    WebPageProxy* page = this->page();
    138100    page->process()->responsivenessTimer()->stop();
    139101}
     
    142104{
    143105    drawUpdateChunkIntoBackingStore(updateChunk);
    144    
    145     WebPageProxy* page = toWK([m_webView pageRef]);
     106
     107    WebPageProxy* page = this->page();
    146108    page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
    147109}
     
    154116            if (!arguments.decode(updateChunk))
    155117                return;
     118
    156119            update(&updateChunk);
    157120            break;
  • trunk/WebKit2/UIProcess/DrawingAreaProxyUpdateChunk.h

    r58184 r58199  
    2929#include "DrawingAreaProxy.h"
    3030#include <WebCore/IntSize.h>
     31
     32#if PLATFORM(MAC)
    3133#include <wtf/RetainPtr.h>
    32 
    3334#ifdef __OBJC__
    3435@class WKView;
     
    3637class WKView;
    3738#endif
     39#endif
    3840
    3941namespace WebKit {
    4042
    4143class UpdateChunk;
     44class WebPageProxy;
     45
     46#if PLATFORM(MAC)
     47typedef WKView PlatformWebView;
     48typedef CGContextRef PlatformDrawingContext;
     49#elif PLATFORM(WIN)
     50class WebView;
     51typedef WebView PlatformWebView;
     52typedef HDC PlatformDrawingContext;
     53#endif
    4254
    4355class DrawingAreaProxyUpdateChunk : public DrawingAreaProxy {
    4456public:
    45     DrawingAreaProxyUpdateChunk(WKView*);
     57    DrawingAreaProxyUpdateChunk(PlatformWebView*);
    4658    virtual ~DrawingAreaProxyUpdateChunk();
    4759
    48     virtual void drawRectIntoContext(CGRect, CGContextRef);
     60    virtual void paint(const WebCore::IntRect&, PlatformDrawingContext);
    4961    virtual void setSize(const WebCore::IntSize&);
    5062
     
    5870
    5971private:
     72    WebPageProxy* page();
     73
     74    void ensureBackingStore();
     75    void invalidateBackingStore();
     76    void platformPaint(const WebCore::IntRect&, PlatformDrawingContext);
    6077    void drawUpdateChunkIntoBackingStore(UpdateChunk*);
    61     void ensureBackingStore();
    62 
    63     void didSetSize(UpdateChunk* updateChunk);
     78    void didSetSize(UpdateChunk*);
    6479    void update(UpdateChunk*);
    6580
    66     bool m_isInitialized;
    6781    bool m_isWaitingForDidSetFrameNotification;
    68 
    6982    WebCore::IntSize m_viewSize; // Size of the BackingStore as well.
    7083    WebCore::IntSize m_lastSetViewSize;
    7184
     85#if PLATFORM(MAC)
     86    // BackingStore
    7287    RetainPtr<CGContextRef> m_bitmapContext;
     88#elif PLATFORM(WIN)
     89    // BackingStore
     90    OwnPtr<HDC> m_backingStoreDC;
     91    OwnPtr<HBITMAP> m_backingStoreBitmap;
     92#endif
    7393
    74     WKView* m_webView;
     94    PlatformWebView* m_webView;
    7595};
    7696   
  • trunk/WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunkMac.mm

    r58184 r58199  
    2424 */
    2525
    26 #import "DrawingAreaProxyUpdateChunk.h"
     26#include "DrawingAreaProxyUpdateChunk.h"
    2727
    28 #import "MessageID.h"
    29 
    30 #import "DrawingAreaMessageKinds.h"
    31 #import "DrawingAreaProxyMessageKinds.h"
    32 #import "WKView.h"
    33 #import "UpdateChunk.h"
    34 #import "WKAPICast.h"
    35 #import "WebCoreTypeArgumentMarshalling.h"
    36 #import "WebPageProxy.h"
    37 #import "WebProcessProxy.h"
     28#include "DrawingAreaMessageKinds.h"
     29#include "DrawingAreaProxyMessageKinds.h"
     30#include "UpdateChunk.h"
     31#include "WKAPICast.h"
     32#include "WKView.h"
     33#include "WebPageProxy.h"
    3834
    3935using namespace WebCore;
     
    4137namespace WebKit {
    4238
    43 DrawingAreaProxyUpdateChunk::DrawingAreaProxyUpdateChunk(WKView* webView)
    44     : DrawingAreaProxy(DrawingAreaUpdateChunkType)
    45     , m_isInitialized(false)
    46     , m_isWaitingForDidSetFrameNotification(false)
    47     , m_webView(webView)
     39WebPageProxy* DrawingAreaProxyUpdateChunk::page()
    4840{
    49 }
    50 
    51 DrawingAreaProxyUpdateChunk::~DrawingAreaProxyUpdateChunk()
    52 {
    53 }
    54 
    55 void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect rect, CGContextRef context)
    56 {
    57     if (!m_isInitialized) {
    58         setSize(IntSize([m_webView frame].size));
    59         m_isInitialized = true;
    60     }
    61 
    62     if (m_isWaitingForDidSetFrameNotification) {
    63         WebPageProxy* page = toWK([m_webView pageRef]);
    64         if (!page->isValid())
    65             return;
    66        
    67         std::auto_ptr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyMessage::DidSetSize, page->pageID(), 0.04);
    68         if (arguments.get())
    69             didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyMessage::DidSetSize), *arguments.get());
    70     }
    71 
    72     if (!m_bitmapContext)
    73         return;
    74 
    75     RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(m_bitmapContext.get()));
    76     CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())), image.get());
    77 }
    78 
    79 void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
    80 {
    81     ensureBackingStore();
    82 
    83     RetainPtr<CGImageRef> image(updateChunk->createImage());
    84     const IntRect& updateChunkRect = updateChunk->rect();
    85    
    86     CGContextDrawImage(m_bitmapContext.get(), CGRectMake(updateChunkRect.x(), m_viewSize.height() - updateChunkRect.bottom(),
    87                                                          updateChunkRect.width(), updateChunkRect.height()), image.get());
    88     [m_webView setNeedsDisplayInRect:NSRectFromCGRect(updateChunkRect)];
     41    return toWK([m_webView pageRef]);
    8942}
    9043
     
    10255}
    10356
    104 void DrawingAreaProxyUpdateChunk::setSize(const IntSize& viewSize)
     57void DrawingAreaProxyUpdateChunk::invalidateBackingStore()
    10558{
    106     m_isInitialized = true;
     59    m_bitmapContext = 0;
     60}
    10761
    108     WebPageProxy* page = toWK([m_webView pageRef]);
    109     if (!page->isValid())
     62void DrawingAreaProxyUpdateChunk::platformPaint(const IntRect& rect, CGContextRef context)
     63{
     64    if (!m_bitmapContext)
    11065        return;
    11166
    112     m_viewSize = viewSize;
    113     m_lastSetViewSize = viewSize;
    114    
    115     if (m_isWaitingForDidSetFrameNotification)
    116         return;
    117     m_isWaitingForDidSetFrameNotification = true;
    118    
    119     page->process()->responsivenessTimer()->start();
    120     page->process()->connection()->send(DrawingAreaMessage::SetSize, page->pageID(), CoreIPC::In(viewSize));
     67    RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(m_bitmapContext.get()));
     68    CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())), image.get());
    12169}
    12270
    123 void DrawingAreaProxyUpdateChunk::didSetSize(UpdateChunk* updateChunk)
     71void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
    12472{
    125     ASSERT(m_isWaitingForDidSetFrameNotification);
    126     m_isWaitingForDidSetFrameNotification = false;
     73    ensureBackingStore();
    12774
    128     IntSize viewSize = updateChunk->rect().size();
     75    RetainPtr<CGImageRef> image(updateChunk->createImage());
     76    const IntRect& updateChunkRect = updateChunk->rect();
    12977
    130     if (viewSize != m_lastSetViewSize)
    131         setSize(m_lastSetViewSize);
    132 
    133     // Invalidate the backing store.
    134     m_bitmapContext = 0;
    135     drawUpdateChunkIntoBackingStore(updateChunk);
    136 
    137     WebPageProxy* page = toWK([m_webView pageRef]);
    138     page->process()->responsivenessTimer()->stop();
    139 }
    140 
    141 void DrawingAreaProxyUpdateChunk::update(UpdateChunk* updateChunk)
    142 {
    143     drawUpdateChunkIntoBackingStore(updateChunk);
    144    
    145     WebPageProxy* page = toWK([m_webView pageRef]);
    146     page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
    147 }
    148 
    149 void DrawingAreaProxyUpdateChunk::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
    150 {
    151     switch (messageID.get<DrawingAreaProxyMessage::Kind>()) {
    152         case DrawingAreaProxyMessage::Update: {
    153             UpdateChunk updateChunk;
    154             if (!arguments.decode(updateChunk))
    155                 return;
    156             update(&updateChunk);
    157             break;
    158         }
    159         case DrawingAreaProxyMessage::DidSetSize: {
    160             UpdateChunk updateChunk;
    161             if (!arguments.decode(CoreIPC::Out(updateChunk)))
    162                 return;
    163 
    164             didSetSize(&updateChunk);
    165             break;
    166         }
    167         default:
    168             ASSERT_NOT_REACHED();
    169     }
     78    CGContextDrawImage(m_bitmapContext.get(), CGRectMake(updateChunkRect.x(), m_viewSize.height() - updateChunkRect.bottom(),
     79                                                         updateChunkRect.width(), updateChunkRect.height()), image.get());
     80    [m_webView setNeedsDisplayInRect:NSRectFromCGRect(updateChunkRect)];
    17081}
    17182
  • trunk/WebKit2/UIProcess/win/DrawingAreaProxyUpdateChunkWin.cpp

    r58189 r58199  
    2424 */
    2525
    26 #include "DrawingAreaProxy.h"
     26#include "DrawingAreaProxyUpdateChunk.h"
    2727
    28 #include "Connection.h"
    29 #include "DrawingAreaMessageKinds.h"
    30 #include "DrawingAreaProxyMessageKinds.h"
    31 #include "MessageID.h"
    3228#include "UpdateChunk.h"
    3329#include "WebProcessProxy.h"
    3430#include "WebView.h"
    3531#include <WebCore/BitmapInfo.h>
    36 #include <WebCore/IntRect.h>
    3732
    3833using namespace WebCore;
     
    4035namespace WebKit {
    4136
    42 DrawingAreaProxy::DrawingAreaProxy(WebView* webView)
    43     : m_isWaitingForDidSetFrameNotification(false)
    44     , m_webView(webView)
     37WebPageProxy* DrawingAreaProxyUpdateChunk::page()
    4538{
     39    return m_webView->page();
    4640}
    4741
    48 DrawingAreaProxy::~DrawingAreaProxy()
    49 {
    50 }
    51 
    52 void DrawingAreaProxy::ensureBackingStore()
     42void DrawingAreaProxyUpdateChunk::ensureBackingStore()
    5343{
    5444    if (m_backingStoreBitmap)
     
    7060}
    7161
    72 void DrawingAreaProxy::paint(HDC hdc, RECT dirtyRect)
     62void DrawingAreaProxyUpdateChunk::invalidateBackingStore()
    7363{
    74     if (m_isWaitingForDidSetFrameNotification) {
    75         WebPageProxy* page = m_webView->page();
    76         if (!page->isValid())
    77             return;
    78        
    79         std::auto_ptr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyMessage::DidSetSize, page->pageID(), 0.04);
    80         if (arguments.get())
    81             didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyMessage::DidSetSize), *arguments.get());
    82     }
     64    m_backingStoreBitmap.clear();
     65}
    8366
     67void DrawingAreaProxyUpdateChunk::platformPaint(const IntRect& rect, HDC hdc)
     68{
    8469    if (!m_backingStoreBitmap)
    8570        return;
    8671
    8772    // BitBlt from the backing-store to the passed in hdc.
    88     IntRect rect(dirtyRect);
    8973    ::BitBlt(hdc, rect.x(), rect.y(), rect.width(), rect.height(), m_backingStoreDC.get(), rect.x(), rect.y(), SRCCOPY);
    9074}
    9175
    92 void DrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
     76void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
    9377{
    9478    ensureBackingStore();
     
    119103}
    120104
    121 void DrawingAreaProxy::setSize(const IntSize& viewSize)
    122 {
    123     WebPageProxy* page = m_webView->page();
    124     if (!page->isValid())
    125         return;
    126 
    127     if (viewSize.isEmpty())
    128         return;
    129 
    130     m_viewSize = viewSize;
    131     m_lastSetViewSize = viewSize;
    132    
    133     if (m_isWaitingForDidSetFrameNotification)
    134         return;
    135     m_isWaitingForDidSetFrameNotification = true;
    136    
    137     page->process()->responsivenessTimer()->start();
    138     page->process()->connection()->send(DrawingAreaMessage::SetSize, page->pageID(), CoreIPC::In(viewSize));
    139 }
    140 
    141 void DrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
    142 {
    143     ASSERT(m_isWaitingForDidSetFrameNotification);
    144     m_isWaitingForDidSetFrameNotification = false;
    145 
    146     IntSize viewSize = updateChunk->frame().size();
    147     if (viewSize != m_lastSetViewSize)
    148         setSize(m_lastSetViewSize);
    149 
    150     // Invalidate the backing store.
    151     m_backingStoreBitmap.clear();
    152     drawUpdateChunkIntoBackingStore(updateChunk);
    153 
    154     WebPageProxy* page = m_webView->page();
    155     page->process()->responsivenessTimer()->stop();
    156 }
    157 
    158 void DrawingAreaProxy::update(UpdateChunk* updateChunk)
    159 {
    160     drawUpdateChunkIntoBackingStore(updateChunk);
    161 
    162     WebPageProxy* page = m_webView->page();
    163     page->process()->connection()->send(DrawingAreaMessage::DidUpdate, page->pageID(), CoreIPC::In());
    164 }
    165 
    166 void DrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
    167 {
    168     switch (messageID.get<DrawingAreaProxyMessage::Kind>()) {
    169         case DrawingAreaProxyMessage::Update: {
    170             UpdateChunk updateChunk;
    171             if (!arguments.decode(updateChunk))
    172                 return;
    173            
    174             update(&updateChunk);
    175             break;
    176         }
    177         case DrawingAreaProxyMessage::DidSetSize: {
    178             UpdateChunk updateChunk;
    179             if (!arguments.decode(CoreIPC::Out(updateChunk)))
    180                 return;
    181 
    182             didSetSize(&updateChunk);
    183             break;
    184         }
    185         default:
    186             ASSERT_NOT_REACHED();
    187     }
    188 }
    189 
    190105} // namespace WebKit
  • trunk/WebKit2/UIProcess/win/WebView.cpp

    r57737 r58199  
    2626#include "WebView.h"
    2727
    28 #include "DrawingAreaProxy.h"
     28#include "DrawingAreaProxyUpdateChunk.h"
    2929#include "RunLoop.h"
    3030#include "WebEventFactory.h"
     
    170170    m_page = pageNamespace->createWebPage();
    171171    m_page->setPageClient(this);
    172     m_page->initializeWebPage(IntRect(rect).size(), new DrawingAreaProxy(this));
     172    m_page->initializeWebPage(IntRect(rect).size(), new DrawingAreaProxyUpdateChunk(this));
    173173
    174174    m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
     
    306306    HDC hdc = ::BeginPaint(m_window, &paintStruct);
    307307
    308     m_page->drawingArea()->paint(hdc, paintStruct.rcPaint);
     308    m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc);
    309309
    310310    ::EndPaint(m_window, &paintStruct);
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r58189 r58199  
    100100                BC20ED66116F971100094A50 /* WKURLCF.h in Headers */ = {isa = PBXBuildFile; fileRef = BC20ED64116F971100094A50 /* WKURLCF.h */; settings = {ATTRIBUTES = (Public, ); }; };
    101101                BC20ED67116F971100094A50 /* WKURLCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC20ED65116F971100094A50 /* WKURLCF.cpp */; };
     102                BC2651F611825EF800243E12 /* DrawingAreaProxyUpdateChunkMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC2651F511825EF800243E12 /* DrawingAreaProxyUpdateChunkMac.mm */; };
     103                BC2652161182608100243E12 /* DrawingAreaProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2652121182608100243E12 /* DrawingAreaProxy.cpp */; };
     104                BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2652131182608100243E12 /* DrawingAreaProxy.h */; };
     105                BC2652181182608100243E12 /* DrawingAreaProxyUpdateChunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2652141182608100243E12 /* DrawingAreaProxyUpdateChunk.cpp */; };
     106                BC2652191182608100243E12 /* DrawingAreaProxyUpdateChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2652151182608100243E12 /* DrawingAreaProxyUpdateChunk.h */; };
    102107                BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E771141970C00A63B1E /* RunLoop.cpp */; };
    103108                BC2E6E881141971500A63B1E /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E781141970C00A63B1E /* RunLoop.h */; };
     
    127132                BC9E969A11457EDE00870E71 /* DrawingAreaProxyMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */; };
    128133                BC9E969C11457F3F00870E71 /* DrawingAreaMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E969B11457F3F00870E71 /* DrawingAreaMessageKinds.h */; };
    129                 BC9E97021145A95600870E71 /* DrawingAreaProxyUpdateChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9E97001145A95600870E71 /* DrawingAreaProxyUpdateChunk.h */; };
    130                 BC9E97031145A95600870E71 /* DrawingAreaProxyUpdateChunk.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC9E97011145A95600870E71 /* DrawingAreaProxyUpdateChunk.mm */; };
    131134                BCB63478116BF10600603215 /* WebKit2.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB63477116BF10600603215 /* WebKit2.h */; settings = {ATTRIBUTES = (Public, ); }; };
    132135                BCB9E2431120DACA00A137E0 /* WebContext.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB9E2411120DACA00A137E0 /* WebContext.h */; };
     
    146149                BCC57162115ADB42001CCAF9 /* NotImplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC57161115ADB42001CCAF9 /* NotImplemented.h */; };
    147150                BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC938E01180DE440085E5FE /* WKContextPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    148                 BCCF085F113F3B8600C650C5 /* DrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF085D113F3B8600C650C5 /* DrawingAreaProxy.h */; };
    149                 BCCF0860113F3B8600C650C5 /* DrawingAreaProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCCF085E113F3B8600C650C5 /* DrawingAreaProxy.mm */; };
    150151                BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCD0042C110C1E27003B8A67 /* CoreServices.framework */; };
    151152                BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD01397110FA420003B8A67 /* WKFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
     
    298299                BC20ED64116F971100094A50 /* WKURLCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLCF.h; sourceTree = "<group>"; };
    299300                BC20ED65116F971100094A50 /* WKURLCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURLCF.cpp; sourceTree = "<group>"; };
     301                BC2651F511825EF800243E12 /* DrawingAreaProxyUpdateChunkMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DrawingAreaProxyUpdateChunkMac.mm; sourceTree = "<group>"; };
     302                BC2652121182608100243E12 /* DrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxy.cpp; sourceTree = "<group>"; };
     303                BC2652131182608100243E12 /* DrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxy.h; sourceTree = "<group>"; };
     304                BC2652141182608100243E12 /* DrawingAreaProxyUpdateChunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxyUpdateChunk.cpp; sourceTree = "<group>"; };
     305                BC2652151182608100243E12 /* DrawingAreaProxyUpdateChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyUpdateChunk.h; sourceTree = "<group>"; };
    300306                BC2E6E771141970C00A63B1E /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
    301307                BC2E6E781141970C00A63B1E /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; };
     
    325331                BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyMessageKinds.h; sourceTree = "<group>"; };
    326332                BC9E969B11457F3F00870E71 /* DrawingAreaMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaMessageKinds.h; sourceTree = "<group>"; };
    327                 BC9E97001145A95600870E71 /* DrawingAreaProxyUpdateChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawingAreaProxyUpdateChunk.h; path = mac/DrawingAreaProxyUpdateChunk.h; sourceTree = "<group>"; };
    328                 BC9E97011145A95600870E71 /* DrawingAreaProxyUpdateChunk.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DrawingAreaProxyUpdateChunk.mm; path = mac/DrawingAreaProxyUpdateChunk.mm; sourceTree = "<group>"; };
    329333                BCB63477116BF10600603215 /* WebKit2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2.h; sourceTree = "<group>"; };
    330334                BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebKit2.xcconfig; sourceTree = "<group>"; };
     
    345349                BCC57161115ADB42001CCAF9 /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; };
    346350                BCC938E01180DE440085E5FE /* WKContextPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextPrivate.h; sourceTree = "<group>"; };
    347                 BCCF085D113F3B8600C650C5 /* DrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawingAreaProxy.h; path = mac/DrawingAreaProxy.h; sourceTree = "<group>"; };
    348                 BCCF085E113F3B8600C650C5 /* DrawingAreaProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DrawingAreaProxy.mm; path = mac/DrawingAreaProxy.mm; sourceTree = "<group>"; };
    349351                BCD0042C110C1E27003B8A67 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
    350352                BCD01397110FA420003B8A67 /* WKFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrame.h; sourceTree = "<group>"; };
     
    593595                                BC111B18112F5FB400337BAB /* Launcher */,
    594596                                BCCF085C113F3B7500C650C5 /* mac */,
     597                                BC2652121182608100243E12 /* DrawingAreaProxy.cpp */,
     598                                BC2652131182608100243E12 /* DrawingAreaProxy.h */,
     599                                BC2652141182608100243E12 /* DrawingAreaProxyUpdateChunk.cpp */,
     600                                BC2652151182608100243E12 /* DrawingAreaProxyUpdateChunk.h */,
    595601                                BC6EDAA5111271C600E7678B /* PageClient.h */,
    596602                                BC597074116591D000551FCA /* ProcessModel.h */,
     
    818824                        isa = PBXGroup;
    819825                        children = (
    820                                 BCCF085D113F3B8600C650C5 /* DrawingAreaProxy.h */,
    821                                 BCCF085E113F3B8600C650C5 /* DrawingAreaProxy.mm */,
    822                                 BC9E97001145A95600870E71 /* DrawingAreaProxyUpdateChunk.h */,
    823                                 BC9E97011145A95600870E71 /* DrawingAreaProxyUpdateChunk.mm */,
    824                         );
    825                         name = mac;
     826                                BC2651F511825EF800243E12 /* DrawingAreaProxyUpdateChunkMac.mm */,
     827                        );
     828                        path = mac;
    826829                        sourceTree = "<group>";
    827830                };
     
    880883                                BCEE98CD1133174C006BCC24 /* WKPageNamespace.h in Headers */,
    881884                                BC1A7C581136E19C00FB7167 /* WebProcessLauncher.h in Headers */,
    882                                 BCCF085F113F3B8600C650C5 /* DrawingAreaProxy.h in Headers */,
    883885                                BC2E6E881141971500A63B1E /* RunLoop.h in Headers */,
    884886                                BC2E6E8C1141971500A63B1E /* WorkItem.h in Headers */,
     
    887889                                BC9E969A11457EDE00870E71 /* DrawingAreaProxyMessageKinds.h in Headers */,
    888890                                BC9E969C11457F3F00870E71 /* DrawingAreaMessageKinds.h in Headers */,
    889                                 BC9E97021145A95600870E71 /* DrawingAreaProxyUpdateChunk.h in Headers */,
    890891                                BC1DD7B2114DC396005ADAF3 /* WebCoreTypeArgumentMarshalling.h in Headers */,
    891892                                BCC56F791159957D001CCAF9 /* MachPort.h in Headers */,
     
    910911                                BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */,
    911912                                BC5F7BB51182376C0052C02C /* DrawingAreaUpdateChunk.h in Headers */,
     913                                BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */,
     914                                BC2652191182608100243E12 /* DrawingAreaProxyUpdateChunk.h in Headers */,
    912915                        );
    913916                        runOnlyForDeploymentPostprocessing = 0;
     
    10431046                                BC963D6B113DD19200574BE2 /* WebPage.cpp in Sources */,
    10441047                                BC963D6E113DD1A500574BE2 /* WebPageMac.mm in Sources */,
    1045                                 BCCF0860113F3B8600C650C5 /* DrawingAreaProxy.mm in Sources */,
    10461048                                BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */,
    10471049                                BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */,
    10481050                                BC9E95D411449B0300870E71 /* UpdateChunk.cpp in Sources */,
    1049                                 BC9E97031145A95600870E71 /* DrawingAreaProxyUpdateChunk.mm in Sources */,
    10501051                                BC0092F7115837A300E0AE2A /* RunLoopMac.mm in Sources */,
    10511052                                BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */,
     
    10631064                                BC5F7BB41182376C0052C02C /* DrawingAreaUpdateChunk.cpp in Sources */,
    10641065                                BC5F7BB9118237990052C02C /* DrawingAreaUpdateChunkMac.cpp in Sources */,
     1066                                BC2651F611825EF800243E12 /* DrawingAreaProxyUpdateChunkMac.mm in Sources */,
     1067                                BC2652161182608100243E12 /* DrawingAreaProxy.cpp in Sources */,
     1068                                BC2652181182608100243E12 /* DrawingAreaProxyUpdateChunk.cpp in Sources */,
    10651069                        );
    10661070                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/win/WebKit2.vcproj

    r58189 r58199  
    705705                        >
    706706                        <File
     707                                RelativePath="..\UIProcess\DrawingAreaProxy.cpp"
     708                                >
     709                        </File>
     710                        <File
     711                                RelativePath="..\UIProcess\DrawingAreaProxy.h"
     712                                >
     713                        </File>
     714                        <File
     715                                RelativePath="..\UIProcess\DrawingAreaProxyUpdateChunk.cpp"
     716                                >
     717                        </File>
     718                        <File
     719                                RelativePath="..\UIProcess\DrawingAreaProxyUpdateChunk.h"
     720                                >
     721                        </File>
     722                        <File
    707723                                RelativePath="..\UIProcess\PageClient.h"
    708724                                >
     
    9961012                                >
    9971013                                <File
    998                                         RelativePath="..\UIProcess\win\DrawingAreaProxy.cpp"
    999                                         >
    1000                                 </File>
    1001                                 <File
    1002                                         RelativePath="..\UIProcess\win\DrawingAreaProxy.h"
     1014                                        RelativePath="..\UIProcess\win\DrawingAreaProxyUpdateChunkWin.cpp"
    10031015                                        >
    10041016                                </File>
Note: See TracChangeset for help on using the changeset viewer.