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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2712343003: Rename FrameLoaderClient* to LocalFrameClient* in web/ (Closed)
Patch Set: Created 3 years, 9 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // How frames are destroyed 69 // How frames are destroyed
70 // ------------------------ 70 // ------------------------
71 // 71 //
72 // The main frame is never destroyed and is re-used. The FrameLoader is re-used 72 // The main frame is never destroyed and is re-used. The FrameLoader is re-used
73 // and a reference to the main frame is kept by the Page. 73 // and a reference to the main frame is kept by the Page.
74 // 74 //
75 // When frame content is replaced, all subframes are destroyed. This happens 75 // When frame content is replaced, all subframes are destroyed. This happens
76 // in Frame::detachChildren for each subframe in a pre-order depth-first 76 // in Frame::detachChildren for each subframe in a pre-order depth-first
77 // traversal. Note that child node order may not match DOM node order! 77 // traversal. Note that child node order may not match DOM node order!
78 // detachChildren() (virtually) calls Frame::detach(), which again calls 78 // detachChildren() (virtually) calls Frame::detach(), which again calls
79 // FrameLoaderClient::detached(). This triggers WebFrame to clear its reference 79 // LocalFrameClient::detached(). This triggers WebFrame to clear its reference
80 // to LocalFrame. FrameLoaderClient::detached() also notifies the embedder via 80 // to LocalFrame. LocalFrameClient::detached() also notifies the embedder via
81 // WebFrameClient that the frame is detached. Most embedders will invoke 81 // WebFrameClient that the frame is detached. Most embedders will invoke
82 // close() on the WebFrame at this point, triggering its deletion unless 82 // close() on the WebFrame at this point, triggering its deletion unless
83 // something else is still retaining a reference. 83 // something else is still retaining a reference.
84 // 84 //
85 // The client is expected to be set whenever the WebLocalFrameImpl is attached 85 // The client is expected to be set whenever the WebLocalFrameImpl is attached
86 // to the DOM. 86 // to the DOM.
87 87
88 #include "web/WebLocalFrameImpl.h" 88 #include "web/WebLocalFrameImpl.h"
89 89
90 #include <algorithm> 90 #include <algorithm>
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); 1486 Frame* oldFrame = oldWebFrame->toImplBase()->frame();
1487 webFrame->setParent(oldWebFrame->parent()); 1487 webFrame->setParent(oldWebFrame->parent());
1488 webFrame->setOpener(oldWebFrame->opener()); 1488 webFrame->setOpener(oldWebFrame->opener());
1489 // Note: this *always* temporarily sets a frame owner, even for main frames! 1489 // Note: this *always* temporarily sets a frame owner, even for main frames!
1490 // When a core Frame is created with no owner, it attempts to set itself as 1490 // When a core Frame is created with no owner, it attempts to set itself as
1491 // the main frame of the Page. However, this is a provisional frame, and may 1491 // the main frame of the Page. However, this is a provisional frame, and may
1492 // disappear, so Page::m_mainFrame can't be updated just yet. 1492 // disappear, so Page::m_mainFrame can't be updated just yet.
1493 FrameOwner* tempOwner = DummyFrameOwner::create(); 1493 FrameOwner* tempOwner = DummyFrameOwner::create();
1494 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to 1494 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to
1495 // reuse it here. 1495 // reuse it here.
1496 LocalFrame* frame = LocalFrame::create( 1496 LocalFrame* frame = LocalFrame::create(webFrame->m_localFrameClientImpl.get(),
1497 webFrame->m_frameLoaderClientImpl.get(), oldFrame->host(), tempOwner, 1497 oldFrame->host(), tempOwner,
1498 interfaceProvider, interfaceRegistry); 1498 interfaceProvider, interfaceRegistry);
1499 // Set the name and unique name directly, bypassing any of the normal logic 1499 // Set the name and unique name directly, bypassing any of the normal logic
1500 // to calculate unique name. 1500 // to calculate unique name.
1501 frame->tree().setPrecalculatedName( 1501 frame->tree().setPrecalculatedName(
1502 toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().name(), 1502 toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().name(),
1503 toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName()); 1503 toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName());
1504 webFrame->setCoreFrame(frame); 1504 webFrame->setCoreFrame(frame);
1505 1505
1506 frame->setOwner(oldFrame->owner()); 1506 frame->setOwner(oldFrame->owner());
1507 1507
1508 if (frame->owner() && frame->owner()->isRemote()) 1508 if (frame->owner() && frame->owner()->isRemote())
1509 toRemoteFrameOwner(frame->owner()) 1509 toRemoteFrameOwner(frame->owner())
1510 ->setSandboxFlags(static_cast<SandboxFlags>(flags)); 1510 ->setSandboxFlags(static_cast<SandboxFlags>(flags));
1511 1511
1512 // We must call init() after m_frame is assigned because it is referenced 1512 // We must call init() after m_frame is assigned because it is referenced
1513 // during init(). Note that this may dispatch JS events; the frame may be 1513 // during init(). Note that this may dispatch JS events; the frame may be
1514 // detached after init() returns. 1514 // detached after init() returns.
1515 frame->init(); 1515 frame->init();
1516 return webFrame; 1516 return webFrame;
1517 } 1517 }
1518 1518
1519 WebLocalFrameImpl::WebLocalFrameImpl( 1519 WebLocalFrameImpl::WebLocalFrameImpl(
1520 WebTreeScopeType scope, 1520 WebTreeScopeType scope,
1521 WebFrameClient* client, 1521 WebFrameClient* client,
1522 blink::InterfaceProvider* interfaceProvider, 1522 blink::InterfaceProvider* interfaceProvider,
1523 blink::InterfaceRegistry* interfaceRegistry) 1523 blink::InterfaceRegistry* interfaceRegistry)
1524 : WebLocalFrame(scope), 1524 : WebLocalFrame(scope),
1525 m_frameLoaderClientImpl(FrameLoaderClientImpl::create(this)), 1525 m_localFrameClientImpl(LocalFrameClientImpl::create(this)),
1526 m_frameWidget(0), 1526 m_frameWidget(0),
1527 m_client(client), 1527 m_client(client),
1528 m_autofillClient(0), 1528 m_autofillClient(0),
1529 m_contentSettingsClient(0), 1529 m_contentSettingsClient(0),
1530 m_inputEventsScaleFactorForEmulation(1), 1530 m_inputEventsScaleFactorForEmulation(1),
1531 m_interfaceProvider(interfaceProvider), 1531 m_interfaceProvider(interfaceProvider),
1532 m_interfaceRegistry(interfaceRegistry), 1532 m_interfaceRegistry(interfaceRegistry),
1533 m_webDevToolsFrontend(0), 1533 m_webDevToolsFrontend(0),
1534 m_inputMethodController(new WebInputMethodControllerImpl(this)), 1534 m_inputMethodController(new WebInputMethodControllerImpl(this)),
1535 m_selfKeepAlive(this) { 1535 m_selfKeepAlive(this) {
(...skipping 13 matching lines...) Expand all
1549 interfaceProvider, 1549 interfaceProvider,
1550 interfaceRegistry) {} 1550 interfaceRegistry) {}
1551 1551
1552 WebLocalFrameImpl::~WebLocalFrameImpl() { 1552 WebLocalFrameImpl::~WebLocalFrameImpl() {
1553 // The widget for the frame, if any, must have already been closed. 1553 // The widget for the frame, if any, must have already been closed.
1554 DCHECK(!m_frameWidget); 1554 DCHECK(!m_frameWidget);
1555 frameCount--; 1555 frameCount--;
1556 } 1556 }
1557 1557
1558 DEFINE_TRACE(WebLocalFrameImpl) { 1558 DEFINE_TRACE(WebLocalFrameImpl) {
1559 visitor->trace(m_frameLoaderClientImpl); 1559 visitor->trace(m_localFrameClientImpl);
1560 visitor->trace(m_frame); 1560 visitor->trace(m_frame);
1561 visitor->trace(m_devToolsAgent); 1561 visitor->trace(m_devToolsAgent);
1562 visitor->trace(m_textFinder); 1562 visitor->trace(m_textFinder);
1563 visitor->trace(m_printContext); 1563 visitor->trace(m_printContext);
1564 visitor->trace(m_contextMenuNode); 1564 visitor->trace(m_contextMenuNode);
1565 WebFrame::traceFrames(visitor, this); 1565 WebFrame::traceFrames(visitor, this);
1566 WebFrameImplBase::trace(visitor); 1566 WebFrameImplBase::trace(visitor);
1567 } 1567 }
1568 1568
1569 void WebLocalFrameImpl::setCoreFrame(LocalFrame* frame) { 1569 void WebLocalFrameImpl::setCoreFrame(LocalFrame* frame) {
1570 m_frame = frame; 1570 m_frame = frame;
1571 } 1571 }
1572 1572
1573 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, 1573 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host,
1574 FrameOwner* owner, 1574 FrameOwner* owner,
1575 const AtomicString& name, 1575 const AtomicString& name,
1576 const AtomicString& uniqueName) { 1576 const AtomicString& uniqueName) {
1577 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner, 1577 setCoreFrame(LocalFrame::create(m_localFrameClientImpl.get(), host, owner,
1578 m_interfaceProvider, m_interfaceRegistry)); 1578 m_interfaceProvider, m_interfaceRegistry));
1579 frame()->tree().setPrecalculatedName(name, uniqueName); 1579 frame()->tree().setPrecalculatedName(name, uniqueName);
1580 // We must call init() after m_frame is assigned because it is referenced 1580 // We must call init() after m_frame is assigned because it is referenced
1581 // during init(). Note that this may dispatch JS events; the frame may be 1581 // during init(). Note that this may dispatch JS events; the frame may be
1582 // detached after init() returns. 1582 // detached after init() returns.
1583 frame()->init(); 1583 frame()->init();
1584 if (frame()) { 1584 if (frame()) {
1585 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() && 1585 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() &&
1586 !parent() && !opener() && 1586 !parent() && !opener() &&
1587 frame()->settings()->getShouldReuseGlobalForUnownedMainFrame()) { 1587 frame()->settings()->getShouldReuseGlobalForUnownedMainFrame()) {
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2438 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2439 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2439 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2440 } else { 2440 } else {
2441 clipHtml = 2441 clipHtml =
2442 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2442 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2443 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2443 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2444 } 2444 }
2445 } 2445 }
2446 2446
2447 } // namespace blink 2447 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698