Skip to content
Permalink
Browse files
Decouple state changes from sending of UpdateState messages in Drawin…
…gAreaProxyImpl

The new DrawingAreaProxyImpl::stateDidChange function should be called whenever
DrawingAreaProxyImpl's state changes in a way that will require allocating a new backing
store. (Currently, this is just when the size changes.) This function will sometimes (but
not always, as when we're waiting for a DidUpdateState message) send an UpdateState message
to the web process. This means it's now possible for the state IDs sent in consecutive
UpdateState messages to increase by more than one, but that's OK.

This should cause no change in behavior.

Fixes <http://webkit.org/b/55382> DrawingAreaProxyImpl's state ID should be updated whenever
its state changes, not just when we send an UpdateState message

Reviewed by Anders Carlsson.

* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): Updated for rename.
(WebKit::DrawingAreaProxyImpl::sizeDidChange): Changed to call stateDidChange.
(WebKit::DrawingAreaProxyImpl::didUpdateState): Updated for rename, and changed to call
sendUpdateState whenever our state has changed for any reason since the last UpdateState
message was sent.
(WebKit::DrawingAreaProxyImpl::stateDidChange): Added. Increments m_nextStateID and calls
through to sendUpdateState.
(WebKit::DrawingAreaProxyImpl::sendUpdateState): Updated for rename, moved incrementing of
the state ID we send to the web process from here to stateDidChange, and added an assertion.

* UIProcess/DrawingAreaProxyImpl.h: Renamed m_requestedStateID to m_nextStateID, and updated
the comment explaining its meaning.

Canonical link: https://commits.webkit.org/69784@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aroben committed Feb 28, 2011
1 parent abf30ce commit 1063398581dec6cfeec49b2749a73de852473426
Showing with 50 additions and 9 deletions.
  1. +32 −0 Source/WebKit2/ChangeLog
  2. +13 −5 Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
  3. +5 −4 Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -1,3 +1,35 @@
2011-02-28 Adam Roben <aroben@apple.com>

Decouple state changes from sending of UpdateState messages in DrawingAreaProxyImpl

The new DrawingAreaProxyImpl::stateDidChange function should be called whenever
DrawingAreaProxyImpl's state changes in a way that will require allocating a new backing
store. (Currently, this is just when the size changes.) This function will sometimes (but
not always, as when we're waiting for a DidUpdateState message) send an UpdateState message
to the web process. This means it's now possible for the state IDs sent in consecutive
UpdateState messages to increase by more than one, but that's OK.

This should cause no change in behavior.

Fixes <http://webkit.org/b/55382> DrawingAreaProxyImpl's state ID should be updated whenever
its state changes, not just when we send an UpdateState message

Reviewed by Anders Carlsson.

* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): Updated for rename.
(WebKit::DrawingAreaProxyImpl::sizeDidChange): Changed to call stateDidChange.
(WebKit::DrawingAreaProxyImpl::didUpdateState): Updated for rename, and changed to call
sendUpdateState whenever our state has changed for any reason since the last UpdateState
message was sent.
(WebKit::DrawingAreaProxyImpl::stateDidChange): Added. Increments m_nextStateID and calls
through to sendUpdateState.
(WebKit::DrawingAreaProxyImpl::sendUpdateState): Updated for rename, moved incrementing of
the state ID we send to the web process from here to stateDidChange, and added an assertion.

* UIProcess/DrawingAreaProxyImpl.h: Renamed m_requestedStateID to m_nextStateID, and updated
the comment explaining its meaning.

2011-02-28 Adam Roben <aroben@apple.com>

Pass the right dirty rect to Plugin::paint
@@ -50,7 +50,7 @@ PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webP
DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
: DrawingAreaProxy(DrawingAreaTypeImpl, webPageProxy)
, m_currentStateID(0)
, m_requestedStateID(0)
, m_nextStateID(0)
, m_isWaitingForDidUpdateState(false)
{
}
@@ -103,7 +103,7 @@ bool DrawingAreaProxyImpl::paint(const WebCore::IntRect&, PlatformDrawingContext

void DrawingAreaProxyImpl::sizeDidChange()
{
sendUpdateState();
stateDidChange();
}

void DrawingAreaProxyImpl::visibilityDidChange()
@@ -136,14 +136,14 @@ void DrawingAreaProxyImpl::update(uint64_t stateID, const UpdateInfo& updateInfo

void DrawingAreaProxyImpl::didUpdateState(uint64_t stateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext)
{
ASSERT_ARG(stateID, stateID <= m_requestedStateID);
ASSERT_ARG(stateID, stateID <= m_nextStateID);
ASSERT_ARG(stateID, stateID > m_currentStateID);
m_currentStateID = stateID;

ASSERT(m_isWaitingForDidUpdateState);
m_isWaitingForDidUpdateState = false;

if (m_size != updateInfo.viewSize)
if (m_nextStateID != m_currentStateID)
sendUpdateState();

if (layerTreeContext != m_layerTreeContext) {
@@ -214,16 +214,24 @@ void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo)
m_webPageProxy->displayView();
}

void DrawingAreaProxyImpl::stateDidChange()
{
++m_nextStateID;
sendUpdateState();
}

void DrawingAreaProxyImpl::sendUpdateState()
{
ASSERT(m_currentStateID < m_nextStateID);

if (!m_webPageProxy->isValid())
return;

if (m_isWaitingForDidUpdateState)
return;

m_isWaitingForDidUpdateState = true;
m_webPageProxy->process()->send(Messages::DrawingArea::UpdateState(++m_requestedStateID, m_size, m_scrollOffset), m_webPageProxy->pageID());
m_webPageProxy->process()->send(Messages::DrawingArea::UpdateState(m_nextStateID, m_size, m_scrollOffset), m_webPageProxy->pageID());
m_scrollOffset = IntSize();

if (!m_layerTreeContext.isEmpty()) {
@@ -61,6 +61,8 @@ class DrawingAreaProxyImpl : public DrawingAreaProxy {
virtual void exitAcceleratedCompositingMode(uint64_t stateID, const UpdateInfo&);

void incorporateUpdate(const UpdateInfo&);

void stateDidChange();
void sendUpdateState();
void waitForAndDispatchDidUpdateState();

@@ -74,10 +76,9 @@ class DrawingAreaProxyImpl : public DrawingAreaProxy {
// as they don't apply to our current backing store.
uint64_t m_currentStateID;

// The state ID we most recently requested the web process update to. Incremented whenever we
// send an UpdateState message to the web process to tell it we need to allocate a new backing
// store.
uint64_t m_requestedStateID;
// The next state ID we will request the web process update to. Incremented whenever our state
// changes in a way that will require a new backing store to be allocated.
uint64_t m_nextStateID;

// The current layer tree context.
LayerTreeContext m_layerTreeContext;

0 comments on commit 1063398

Please sign in to comment.