Merge revision 736 and revision 737 changes:

- Fix crashes/assertions when CefBrowserImpl is destroyed on a non-UI thread (issue #694).
- Improve the handling of invalidation/painting for off-screen rendering (issue #695).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@738 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-08-13 16:36:57 +00:00
parent be1fd6d3c3
commit f0e11cc5df
10 changed files with 162 additions and 234 deletions

View File

@ -57,7 +57,7 @@ BrowserNavigationController::~BrowserNavigationController() {
}
void BrowserNavigationController::Reset() {
entries_.clear();
entries_.reset();
DiscardPendingEntry();
last_committed_entry_index_ = -1;
@ -111,7 +111,8 @@ BrowserNavigationEntry* BrowserNavigationController::GetLastCommittedEntry()
const {
if (last_committed_entry_index_ == -1)
return NULL;
return entries_[last_committed_entry_index_].get();
return const_cast<BrowserNavigationEntry*>(
entries_[last_committed_entry_index_]);
}
BrowserNavigationEntry* BrowserNavigationController::GetActiveEntry() const {
@ -133,13 +134,14 @@ BrowserNavigationEntry* BrowserNavigationController::GetEntryAtIndex(
if (index < 0 || index >= GetEntryCount())
return NULL;
return entries_[index].get();
return const_cast<BrowserNavigationEntry*>(entries_[index]);
}
BrowserNavigationEntry* BrowserNavigationController::GetEntryWithPageID(
int32 page_id) const {
int index = GetEntryIndexWithPageID(page_id);
return (index != -1) ? entries_[index].get() : NULL;
return (index != -1) ?
const_cast<BrowserNavigationEntry*>(entries_[index]) : NULL;
}
void BrowserNavigationController::DidNavigateToEntry(
@ -158,7 +160,7 @@ void BrowserNavigationController::DidNavigateToEntry(
int existing_entry_index = GetEntryIndexWithPageID(entry->GetPageID());
BrowserNavigationEntry* existing_entry = (existing_entry_index != -1) ?
entries_[existing_entry_index].get() : NULL;
entries_[existing_entry_index] : NULL;
if (!existing_entry) {
// No existing entry, then simply ignore this navigation!
DLOG(WARNING) << "ignoring navigation for page: " << entry->GetPageID();
@ -191,7 +193,7 @@ void BrowserNavigationController::DidNavigateToEntry(
}
void BrowserNavigationController::DiscardPendingEntry() {
if (pending_entry_index_ == -1)
if (pending_entry_index_ == -1 && pending_entry_)
delete pending_entry_;
pending_entry_ = NULL;
pending_entry_index_ = -1;
@ -204,19 +206,19 @@ void BrowserNavigationController::InsertEntry(BrowserNavigationEntry* entry) {
if (settings.history_disabled) {
// History is disabled. Remove any existing entries.
if (entries_.size() > 0)
entries_.clear();
entries_.reset();
} else {
// Prune any entry which are in front of the current entry.
int current_size = static_cast<int>(entries_.size());
if (current_size > 0) {
while (last_committed_entry_index_ < (current_size - 1)) {
entries_.pop_back();
entries_.erase(entries_.end() - 1);
current_size--;
}
}
}
entries_.push_back(linked_ptr<BrowserNavigationEntry>(entry));
entries_.push_back(entry);
last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1;
UpdateMaxPageID();
}
@ -234,7 +236,7 @@ void BrowserNavigationController::NavigateToPendingEntry(bool reload,
// For session history navigations only the pending_entry_index_ is set.
if (!pending_entry_) {
DCHECK_NE(pending_entry_index_, -1);
pending_entry_ = entries_[pending_entry_index_].get();
pending_entry_ = entries_[pending_entry_index_];
}
if (browser_->UIT_Navigate(*pending_entry_, reload, ignoreCache)) {