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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1447563002: Implement frame attribution (FrameBlamer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 #include "base/memory/shared_memory.h" 22 #include "base/memory/shared_memory.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/metrics/field_trial.h" 24 #include "base/metrics/field_trial.h"
25 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
26 #include "base/process/process.h" 26 #include "base/process/process.h"
27 #include "base/stl_util.h" 27 #include "base/stl_util.h"
28 #include "base/strings/string16.h" 28 #include "base/strings/string16.h"
29 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
30 #include "base/thread_task_runner_handle.h" 30 #include "base/thread_task_runner_handle.h"
31 #include "base/time/time.h" 31 #include "base/time/time.h"
32 #include "base/trace_event/trace_event_argument.h"
32 #include "build/build_config.h" 33 #include "build/build_config.h"
33 #include "cc/base/switches.h" 34 #include "cc/base/switches.h"
34 #include "components/scheduler/renderer/renderer_scheduler.h" 35 #include "components/scheduler/renderer/renderer_scheduler.h"
35 #include "content/child/appcache/appcache_dispatcher.h" 36 #include "content/child/appcache/appcache_dispatcher.h"
36 #include "content/child/permissions/permission_dispatcher.h" 37 #include "content/child/permissions/permission_dispatcher.h"
37 #include "content/child/plugin_messages.h" 38 #include "content/child/plugin_messages.h"
38 #include "content/child/quota_dispatcher.h" 39 #include "content/child/quota_dispatcher.h"
39 #include "content/child/request_extra_data.h" 40 #include "content/child/request_extra_data.h"
40 #include "content/child/service_worker/service_worker_handle_reference.h" 41 #include "content/child/service_worker/service_worker_handle_reference.h"
41 #include "content/child/service_worker/service_worker_network_provider.h" 42 #include "content/child/service_worker/service_worker_network_provider.h"
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 geolocation_dispatcher_(NULL), 1009 geolocation_dispatcher_(NULL),
1009 push_messaging_dispatcher_(NULL), 1010 push_messaging_dispatcher_(NULL),
1010 presentation_dispatcher_(NULL), 1011 presentation_dispatcher_(NULL),
1011 screen_orientation_dispatcher_(NULL), 1012 screen_orientation_dispatcher_(NULL),
1012 manifest_manager_(NULL), 1013 manifest_manager_(NULL),
1013 accessibility_mode_(AccessibilityModeOff), 1014 accessibility_mode_(AccessibilityModeOff),
1014 renderer_accessibility_(NULL), 1015 renderer_accessibility_(NULL),
1015 media_player_delegate_(NULL), 1016 media_player_delegate_(NULL),
1016 is_using_lofi_(false), 1017 is_using_lofi_(false),
1017 is_pasting_(false), 1018 is_pasting_(false),
1019 blame_context_(nullptr),
1018 weak_factory_(this) { 1020 weak_factory_(this) {
1019 std::pair<RoutingIDFrameMap::iterator, bool> result = 1021 std::pair<RoutingIDFrameMap::iterator, bool> result =
1020 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); 1022 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
1021 CHECK(result.second) << "Inserting a duplicate item."; 1023 CHECK(result.second) << "Inserting a duplicate item.";
1022 1024
1023 RenderThread::Get()->AddRoute(routing_id_, this); 1025 RenderThread::Get()->AddRoute(routing_id_, this);
1024 1026
1025 render_view_->RegisterRenderFrame(this); 1027 render_view_->RegisterRenderFrame(this);
1026 1028
1027 // Everything below subclasses RenderFrameObserver and is automatically 1029 // Everything below subclasses RenderFrameObserver and is automatically
(...skipping 29 matching lines...) Expand all
1057 render_view_->main_render_frame_ = nullptr; 1059 render_view_->main_render_frame_ = nullptr;
1058 } 1060 }
1059 1061
1060 render_view_->UnregisterRenderFrame(this); 1062 render_view_->UnregisterRenderFrame(this);
1061 g_routing_id_frame_map.Get().erase(routing_id_); 1063 g_routing_id_frame_map.Get().erase(routing_id_);
1062 RenderThread::Get()->RemoveRoute(routing_id_); 1064 RenderThread::Get()->RemoveRoute(routing_id_);
1063 } 1065 }
1064 1066
1065 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) { 1067 void RenderFrameImpl::BindToWebFrame(blink::WebLocalFrame* web_frame) {
1066 DCHECK(!frame_); 1068 DCHECK(!frame_);
1069 DCHECK(!blame_context_);
1067 1070
1068 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert( 1071 std::pair<FrameMap::iterator, bool> result = g_frame_map.Get().insert(
1069 std::make_pair(web_frame, this)); 1072 std::make_pair(web_frame, this));
1070 CHECK(result.second) << "Inserting a duplicate item."; 1073 CHECK(result.second) << "Inserting a duplicate item.";
1071 1074
1072 frame_ = web_frame; 1075 frame_ = web_frame;
1076 blame_context_ = new RenderFrameBlameContext(this);
1077 blame_context_->Initialize();
1073 } 1078 }
1074 1079
1075 void RenderFrameImpl::Initialize() { 1080 void RenderFrameImpl::Initialize() {
1076 is_main_frame_ = !frame_->parent(); 1081 is_main_frame_ = !frame_->parent();
1077 1082
1078 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( 1083 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame(
1079 frame_->parent()); 1084 frame_->parent());
1080 if (parent_frame) 1085 if (parent_frame)
1081 is_using_lofi_ = parent_frame->IsUsingLoFi(); 1086 is_using_lofi_ = parent_frame->IsUsingLoFi();
1082 1087
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 return external_popup_menu_.get(); 2518 return external_popup_menu_.get();
2514 #else 2519 #else
2515 return NULL; 2520 return NULL;
2516 #endif 2521 #endif
2517 } 2522 }
2518 2523
2519 blink::WebCookieJar* RenderFrameImpl::cookieJar() { 2524 blink::WebCookieJar* RenderFrameImpl::cookieJar() {
2520 return &cookie_jar_; 2525 return &cookie_jar_;
2521 } 2526 }
2522 2527
2528 blink::BlameContext* RenderFrameImpl::frameBlameContext() {
2529 DCHECK(blame_context_);
2530 return blame_context_;
2531 }
2532
2523 blink::WebServiceWorkerProvider* 2533 blink::WebServiceWorkerProvider*
2524 RenderFrameImpl::createServiceWorkerProvider() { 2534 RenderFrameImpl::createServiceWorkerProvider() {
2525 // At this point we should have non-null data source. 2535 // At this point we should have non-null data source.
2526 DCHECK(frame_->dataSource()); 2536 DCHECK(frame_->dataSource());
2527 if (!ChildThreadImpl::current()) 2537 if (!ChildThreadImpl::current())
2528 return nullptr; // May be null in some tests. 2538 return nullptr; // May be null in some tests.
2529 ServiceWorkerNetworkProvider* provider = 2539 ServiceWorkerNetworkProvider* provider =
2530 ServiceWorkerNetworkProvider::FromDocumentState( 2540 ServiceWorkerNetworkProvider::FromDocumentState(
2531 DocumentState::FromDataSource(frame_->dataSource())); 2541 DocumentState::FromDataSource(frame_->dataSource()));
2532 DCHECK(provider); 2542 DCHECK(provider);
(...skipping 3468 matching lines...) Expand 10 before | Expand all | Expand 10 after
6001 int match_count, 6011 int match_count,
6002 int ordinal, 6012 int ordinal,
6003 const WebRect& selection_rect, 6013 const WebRect& selection_rect,
6004 bool final_status_update) { 6014 bool final_status_update) {
6005 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6015 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6006 selection_rect, ordinal, 6016 selection_rect, ordinal,
6007 final_status_update)); 6017 final_status_update));
6008 } 6018 }
6009 6019
6010 } // namespace content 6020 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698