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

Side by Side Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/web_contents_delegate.h" 47 #include "content/public/browser/web_contents_delegate.h"
48 #include "content/public/common/browser_side_navigation_policy.h" 48 #include "content/public/common/browser_side_navigation_policy.h"
49 49
50 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
51 #include "content/public/browser/render_widget_host_view.h" 51 #include "content/public/browser/render_widget_host_view.h"
52 #include "services/device/public/interfaces/wake_lock_context.mojom.h" 52 #include "services/device/public/interfaces/wake_lock_context.mojom.h"
53 #endif 53 #endif
54 54
55 namespace content { 55 namespace content {
56 56
57 typedef std::vector<RenderFrameDevToolsAgentHost*> Instances; 57 typedef std::vector<RenderFrameDevToolsAgentHost*> AgentHostArray;
58 58
59 namespace { 59 namespace {
60 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; 60 base::LazyInstance<AgentHostArray>::Leaky g_agent_host_instances = LAZY_INSTANCE _INITIALIZER;
61 61
62 RenderFrameDevToolsAgentHost* FindAgentHost(FrameTreeNode* frame_tree_node) { 62 RenderFrameDevToolsAgentHost* FindAgentHost(FrameTreeNode* frame_tree_node) {
63 if (g_instances == NULL) 63 if (g_agent_host_instances == NULL)
64 return NULL; 64 return NULL;
65 for (Instances::iterator it = g_instances.Get().begin(); 65 for (AgentHostArray::iterator it = g_agent_host_instances.Get().begin();
66 it != g_instances.Get().end(); ++it) { 66 it != g_agent_host_instances.Get().end(); ++it) {
67 if ((*it)->frame_tree_node() == frame_tree_node) 67 if ((*it)->frame_tree_node() == frame_tree_node)
68 return *it; 68 return *it;
69 } 69 }
70 return NULL; 70 return NULL;
71 } 71 }
72 72
73 bool ShouldCreateDevToolsForHost(RenderFrameHost* rfh) { 73 bool ShouldCreateDevToolsForHost(RenderFrameHost* rfh) {
74 return rfh->IsCrossProcessSubframe() || !rfh->GetParent(); 74 return rfh->IsCrossProcessSubframe() || !rfh->GetParent();
75 } 75 }
76 76
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 422 }
423 } 423 }
424 WebContentsObserver::Observe( 424 WebContentsObserver::Observe(
425 WebContentsImpl::FromFrameTreeNode(frame_tree_node)); 425 WebContentsImpl::FromFrameTreeNode(frame_tree_node));
426 426
427 if (web_contents() && web_contents()->GetCrashedStatus() != 427 if (web_contents() && web_contents()->GetCrashedStatus() !=
428 base::TERMINATION_STATUS_STILL_RUNNING) { 428 base::TERMINATION_STATUS_STILL_RUNNING) {
429 current_frame_crashed_ = true; 429 current_frame_crashed_ = true;
430 } 430 }
431 431
432 g_instances.Get().push_back(this); 432 g_agent_host_instances.Get().push_back(this);
433 AddRef(); // Balanced in RenderFrameHostDestroyed. 433 AddRef(); // Balanced in RenderFrameHostDestroyed.
434 434
435 NotifyCreated(); 435 NotifyCreated();
436 } 436 }
437 437
438 void RenderFrameDevToolsAgentHost::SetPending(RenderFrameHostImpl* host) { 438 void RenderFrameDevToolsAgentHost::SetPending(RenderFrameHostImpl* host) {
439 DCHECK(!IsBrowserSideNavigationEnabled()); 439 DCHECK(!IsBrowserSideNavigationEnabled());
440 DCHECK(!pending_); 440 DCHECK(!pending_);
441 current_frame_crashed_ = false; 441 current_frame_crashed_ = false;
442 pending_.reset(new FrameHostHolder(this, host)); 442 pending_.reset(new FrameHostHolder(this, host));
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 void RenderFrameDevToolsAgentHost::OnClientsDetached() { 606 void RenderFrameDevToolsAgentHost::OnClientsDetached() {
607 #if defined(OS_ANDROID) 607 #if defined(OS_ANDROID)
608 GetWakeLock()->CancelWakeLock(); 608 GetWakeLock()->CancelWakeLock();
609 #endif 609 #endif
610 frame_trace_recorder_.reset(); 610 frame_trace_recorder_.reset();
611 if (IsBrowserSideNavigationEnabled()) 611 if (IsBrowserSideNavigationEnabled())
612 RevokePolicy(frame_host_); 612 RevokePolicy(frame_host_);
613 } 613 }
614 614
615 RenderFrameDevToolsAgentHost::~RenderFrameDevToolsAgentHost() { 615 RenderFrameDevToolsAgentHost::~RenderFrameDevToolsAgentHost() {
616 Instances::iterator it = std::find(g_instances.Get().begin(), 616 AgentHostArray::iterator it = std::find(g_agent_host_instances.Get().begin(),
617 g_instances.Get().end(), 617 g_agent_host_instances.Get().end(),
618 this); 618 this);
619 if (it != g_instances.Get().end()) 619 if (it != g_agent_host_instances.Get().end())
620 g_instances.Get().erase(it); 620 g_agent_host_instances.Get().erase(it);
621 } 621 }
622 622
623 void RenderFrameDevToolsAgentHost::ReadyToCommitNavigation( 623 void RenderFrameDevToolsAgentHost::ReadyToCommitNavigation(
624 NavigationHandle* navigation_handle) { 624 NavigationHandle* navigation_handle) {
625 if (!IsBrowserSideNavigationEnabled()) 625 if (!IsBrowserSideNavigationEnabled())
626 return; 626 return;
627 NavigationHandleImpl* handle = 627 NavigationHandleImpl* handle =
628 static_cast<NavigationHandleImpl*>(navigation_handle); 628 static_cast<NavigationHandleImpl*>(navigation_handle);
629 if (handle->frame_tree_node() != frame_tree_node_) 629 if (handle->frame_tree_node() != frame_tree_node_)
630 return; 630 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies( 742 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies(
743 host->GetProcess()->GetID()); 743 host->GetProcess()->GetID());
744 } 744 }
745 745
746 void RenderFrameDevToolsAgentHost::RevokePolicy(RenderFrameHostImpl* host) { 746 void RenderFrameDevToolsAgentHost::RevokePolicy(RenderFrameHostImpl* host) {
747 if (!host) 747 if (!host)
748 return; 748 return;
749 749
750 bool process_has_agents = false; 750 bool process_has_agents = false;
751 RenderProcessHost* process_host = host->GetProcess(); 751 RenderProcessHost* process_host = host->GetProcess();
752 for (RenderFrameDevToolsAgentHost* agent : g_instances.Get()) { 752 for (RenderFrameDevToolsAgentHost* agent : g_agent_host_instances.Get()) {
753 if (!agent->IsAttached()) 753 if (!agent->IsAttached())
754 continue; 754 continue;
755 if (IsBrowserSideNavigationEnabled()) { 755 if (IsBrowserSideNavigationEnabled()) {
756 if (agent->frame_host_ && agent->frame_host_ != host && 756 if (agent->frame_host_ && agent->frame_host_ != host &&
757 agent->frame_host_->GetProcess() == process_host) { 757 agent->frame_host_->GetProcess() == process_host) {
758 process_has_agents = true; 758 process_has_agents = true;
759 } 759 }
760 continue; 760 continue;
761 } 761 }
762 if (agent->current_ && agent->current_->host() != host && 762 if (agent->current_ && agent->current_->host() != host &&
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 bool RenderFrameDevToolsAgentHost::IsChildFrame() { 1311 bool RenderFrameDevToolsAgentHost::IsChildFrame() {
1312 return frame_tree_node_ && frame_tree_node_->parent(); 1312 return frame_tree_node_ && frame_tree_node_->parent();
1313 } 1313 }
1314 1314
1315 DevToolsSession* RenderFrameDevToolsAgentHost::SingleSession() { 1315 DevToolsSession* RenderFrameDevToolsAgentHost::SingleSession() {
1316 DCHECK(!IsBrowserSideNavigationEnabled()); 1316 DCHECK(!IsBrowserSideNavigationEnabled());
1317 return sessions().empty() ? nullptr : *sessions().begin(); 1317 return sessions().empty() ? nullptr : *sessions().begin();
1318 } 1318 }
1319 1319
1320 } // namespace content 1320 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_io_context.cc ('k') | content/browser/dom_storage/local_storage_context_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698