| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo_bindings_controller.h" | 5 #include "content/renderer/mojo_bindings_controller.h" |
| 6 | 6 |
| 7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
| 8 #include "content/public/renderer/render_frame.h" | 8 #include "content/public/renderer/render_frame.h" |
| 9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
| 10 #include "content/renderer/mojo_context_state.h" | 10 #include "content/renderer/mojo_context_state.h" |
| 11 #include "gin/per_context_data.h" | 11 #include "gin/per_context_data.h" |
| 12 #include "third_party/WebKit/public/web/WebKit.h" | 12 #include "third_party/WebKit/public/web/WebKit.h" |
| 13 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 13 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 14 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
| 15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const char kMojoContextStateKey[] = "MojoContextState"; | 21 const char kMojoContextStateKey[] = "MojoContextState"; |
| 22 | 22 |
| 23 struct MojoContextStateData : public base::SupportsUserData::Data { | 23 struct MojoContextStateData : public base::SupportsUserData::Data { |
| 24 scoped_ptr<MojoContextState> state; | 24 std::unique_ptr<MojoContextState> state; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 MojoBindingsController::MojoBindingsController(RenderFrame* render_frame, | 29 MojoBindingsController::MojoBindingsController(RenderFrame* render_frame, |
| 30 bool for_layout_tests) | 30 bool for_layout_tests) |
| 31 : RenderFrameObserver(render_frame), | 31 : RenderFrameObserver(render_frame), |
| 32 RenderFrameObserverTracker<MojoBindingsController>(render_frame), | 32 RenderFrameObserverTracker<MojoBindingsController>(render_frame), |
| 33 for_layout_tests_(for_layout_tests) {} | 33 for_layout_tests_(for_layout_tests) {} |
| 34 | 34 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // be empty and we don't need to destroy it. | 92 // be empty and we don't need to destroy it. |
| 93 MojoContextState* state = GetContextState(); | 93 MojoContextState* state = GetContextState(); |
| 94 if (state && !state->module_added()) | 94 if (state && !state->module_added()) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 97 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 98 DestroyContextState(render_frame()->GetWebFrame()->mainWorldScriptContext()); | 98 DestroyContextState(render_frame()->GetWebFrame()->mainWorldScriptContext()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace content | 101 } // namespace content |
| OLD | NEW |