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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp

Issue 2948983002: Low memory page navigation GC for low end devices (Closed)
Patch Set: fix Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "platform/bindings/V8PrivateProperty.h" 57 #include "platform/bindings/V8PrivateProperty.h"
58 #include "platform/heap/Handle.h" 58 #include "platform/heap/Handle.h"
59 #include "platform/instrumentation/tracing/TraceEvent.h" 59 #include "platform/instrumentation/tracing/TraceEvent.h"
60 #include "platform/weborigin/SecurityOrigin.h" 60 #include "platform/weborigin/SecurityOrigin.h"
61 #include "platform/weborigin/SecurityViolationReportingPolicy.h" 61 #include "platform/weborigin/SecurityViolationReportingPolicy.h"
62 #include "platform/wtf/Assertions.h" 62 #include "platform/wtf/Assertions.h"
63 #include "v8/include/v8.h" 63 #include "v8/include/v8.h"
64 64
65 namespace blink { 65 namespace blink {
66 66
67 void LocalWindowProxy::DisposeContext(Lifecycle next_status) { 67 void LocalWindowProxy::DisposeContext(Lifecycle next_status,
68 FrameReuseStatus frame_reuse_status) {
68 DCHECK(next_status == Lifecycle::kGlobalObjectIsDetached || 69 DCHECK(next_status == Lifecycle::kGlobalObjectIsDetached ||
69 next_status == Lifecycle::kFrameIsDetached); 70 next_status == Lifecycle::kFrameIsDetached);
70 71
71 if (lifecycle_ != Lifecycle::kContextIsInitialized) 72 if (lifecycle_ != Lifecycle::kContextIsInitialized)
72 return; 73 return;
73 74
74 ScriptState::Scope scope(script_state_.Get()); 75 ScriptState::Scope scope(script_state_.Get());
75 v8::Local<v8::Context> context = script_state_->GetContext(); 76 v8::Local<v8::Context> context = script_state_->GetContext();
76 // The embedder could run arbitrary code in response to the 77 // The embedder could run arbitrary code in response to the
77 // willReleaseScriptContext callback, so all disposing should happen after 78 // willReleaseScriptContext callback, so all disposing should happen after
(...skipping 14 matching lines...) Expand all
92 } 93 }
93 V8DOMWrapper::ClearNativeInfo(GetIsolate(), context->Global()); 94 V8DOMWrapper::ClearNativeInfo(GetIsolate(), context->Global());
94 script_state_->DetachGlobalObject(); 95 script_state_->DetachGlobalObject();
95 96
96 #if DCHECK_IS_ON() 97 #if DCHECK_IS_ON()
97 DidDetachGlobalObject(); 98 DidDetachGlobalObject();
98 #endif 99 #endif
99 } 100 }
100 101
101 script_state_->DisposePerContextData(); 102 script_state_->DisposePerContextData();
102
103 // It's likely that disposing the context has created a lot of 103 // It's likely that disposing the context has created a lot of
104 // garbage. Notify V8 about this so it'll have a chance of cleaning 104 // garbage. Notify V8 about this so it'll have a chance of cleaning
105 // it up when idle. 105 // it up when idle.
106 V8GCForContextDispose::Instance().NotifyContextDisposed( 106 V8GCForContextDispose::Instance().NotifyContextDisposed(
107 GetFrame()->IsMainFrame()); 107 GetFrame()->IsMainFrame(), frame_reuse_status);
108 108
109 if (next_status == Lifecycle::kFrameIsDetached) { 109 if (next_status == Lifecycle::kFrameIsDetached) {
110 // The context's frame is detached from the DOM, so there shouldn't be a 110 // The context's frame is detached from the DOM, so there shouldn't be a
111 // strong reference to the context. 111 // strong reference to the context.
112 global_proxy_.SetPhantom(); 112 global_proxy_.SetPhantom();
113 } 113 }
114 114
115 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); 115 DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized);
116 lifecycle_ = next_status; 116 lifecycle_ = next_status;
117 } 117 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 SetSecurityToken(origin); 469 SetSecurityToken(origin);
470 } 470 }
471 471
472 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, 472 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate,
473 LocalFrame& frame, 473 LocalFrame& frame,
474 RefPtr<DOMWrapperWorld> world) 474 RefPtr<DOMWrapperWorld> world)
475 : WindowProxy(isolate, frame, std::move(world)) {} 475 : WindowProxy(isolate, frame, std::move(world)) {}
476 476
477 } // namespace blink 477 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698