Skip to content

Commit

Permalink
Exploit reference counting for View actors
Browse files Browse the repository at this point in the history
  • Loading branch information
rojkov committed Nov 19, 2014
1 parent d85c711 commit 4600082
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion embedding/embedlite/embedthread/EmbedLiteAppThreadChild.cpp
Expand Up @@ -168,6 +168,7 @@ EmbedLiteAppThreadChild::AllocPEmbedLiteViewChild(const uint32_t& id, const uint
LOGT("id:%u, parentId:%u", id, parentId);
EmbedLiteViewThreadChild* view = new EmbedLiteViewThreadChild(id, parentId);
mWeakViewMap[id] = view;
view->AddRef();
return view;
}

Expand All @@ -182,7 +183,8 @@ EmbedLiteAppThreadChild::DeallocPEmbedLiteViewChild(PEmbedLiteViewChild* actor)
}
}
mWeakViewMap.erase(it);
delete actor;
EmbedLiteViewThreadChild* p = static_cast<EmbedLiteViewThreadChild*>(actor);
p->Release();
return true;
}

Expand Down
7 changes: 5 additions & 2 deletions embedding/embedlite/embedthread/EmbedLiteAppThreadParent.cpp
Expand Up @@ -82,14 +82,17 @@ PEmbedLiteViewParent*
EmbedLiteAppThreadParent::AllocPEmbedLiteViewParent(const uint32_t& id, const uint32_t& parentId)
{
LOGT("id:%u, parent:%u", id, parentId);
return new EmbedLiteViewThreadParent(id, parentId);
EmbedLiteViewThreadParent* p = new EmbedLiteViewThreadParent(id, parentId);
p->AddRef();
return p;
}

bool
EmbedLiteAppThreadParent::DeallocPEmbedLiteViewParent(PEmbedLiteViewParent* actor)
{
LOGT();
delete actor;
EmbedLiteViewThreadParent* p = static_cast<EmbedLiteViewThreadParent *>(actor);
p->Release();
return true;
}

Expand Down
Expand Up @@ -85,7 +85,6 @@ EmbedLiteViewThreadChild::EmbedLiteViewThreadChild(const uint32_t& aId, const ui
, mPendingTouchPreventedBlockId(0)
{
LOGT("id:%u, parentID:%u", aId, parentId);
AddRef();
// Init default prefs
static bool sPrefInitialized = false;
if (!sPrefInitialized) {
Expand Down

0 comments on commit 4600082

Please sign in to comment.