Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 2873503002: NOT YET READY: Improve granularity of window namespaces in Blink.
Patch Set: Rebasing... Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/web/LocalFrameClientImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/Page.cpp
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
index 4a083020409fba2b7999b1c52cfb1bf00e5c6589..1a12f7a059098223958b1aa4c38303d29dd1cf55 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -78,6 +78,16 @@ Page::PageSet& Page::OrdinaryPages() {
return pages;
}
+HeapVector<Member<Page>> Page::RelatedPages() {
+ HeapVector<Member<Page>> result;
+ Page* ptr = this->next_related_page_;
+ while (ptr != this) {
+ result.push_back(ptr);
+ ptr = ptr->next_related_page_;
+ }
+ return result;
+}
+
float DeviceScaleFactorDeprecated(LocalFrame* frame) {
if (!frame)
return 1;
@@ -87,8 +97,19 @@ float DeviceScaleFactorDeprecated(LocalFrame* frame) {
return page->DeviceScaleFactorDeprecated();
}
-Page* Page::CreateOrdinary(PageClients& page_clients) {
+Page* Page::CreateOrdinary(PageClients& page_clients, Page* opener) {
Page* page = Create(page_clients);
+
+ if (opener) {
+ // Before: ... -> opener -> next -> ...
+ // After: ... -> opener -> page -> next -> ...
+ Page* next = opener->next_related_page_;
+ opener->next_related_page_ = page;
+ page->prev_related_page_ = opener;
+ page->next_related_page_ = next;
+ next->prev_related_page_ = page;
+ }
+
OrdinaryPages().insert(page);
if (ScopedPageSuspender::IsActive())
page->SetSuspended(true);
@@ -130,7 +151,9 @@ Page::Page(PageClients& page_clients)
device_scale_factor_(1),
visibility_state_(kPageVisibilityStateVisible),
is_cursor_visible_(true),
- subframe_count_(0) {
+ subframe_count_(0),
+ next_related_page_(this),
+ prev_related_page_(this) {
DCHECK(editor_client_);
DCHECK(!AllPages().Contains(this));
@@ -639,6 +662,8 @@ DEFINE_TRACE(Page) {
visitor->Trace(plugin_data_);
visitor->Trace(validation_message_client_);
visitor->Trace(use_counter_);
+ visitor->Trace(next_related_page_);
+ visitor->Trace(prev_related_page_);
Supplementable<Page>::Trace(visitor);
PageVisibilityNotifier::Trace(visitor);
}
@@ -667,6 +692,18 @@ void Page::WillBeDestroyed() {
AllPages().erase(this);
OrdinaryPages().erase(this);
+ {
+ // Before: ... -> prev -> this -> next -> ...
+ // After: ... -> prev -> next -> ...
+ // (this is ok even if |this| is the only element on the list).
+ Page* prev = this->prev_related_page_;
+ Page* next = this->next_related_page_;
+ next->prev_related_page_ = prev;
+ prev->next_related_page_ = next;
+ this->prev_related_page_ = nullptr;
+ this->next_related_page_ = nullptr;
+ }
+
if (scrolling_coordinator_)
scrolling_coordinator_->WillBeDestroyed();
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/web/LocalFrameClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698