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

Side by Side Diff: ios/web_view/shell/shell_view_controller.m

Issue 2847803006: Fix a crash bug on deallocation of CWVWebView caused by CWVScrollView. (Closed)
Patch Set: Rebase. Created 3 years, 7 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
« no previous file with comments | « ios/web_view/internal/cwv_scroll_view.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "ios/web_view/shell/shell_view_controller.h" 5 #import "ios/web_view/shell/shell_view_controller.h"
6 6
7 #import <ChromeWebView/ChromeWebView.h> 7 #import <ChromeWebView/ChromeWebView.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 9
10 #import "ios/web_view/shell/translate_controller.h" 10 #import "ios/web_view/shell/translate_controller.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 message:@"" 196 message:@""
197 preferredStyle:UIAlertControllerStyleActionSheet]; 197 preferredStyle:UIAlertControllerStyleActionSheet];
198 198
199 [alertController 199 [alertController
200 addAction:[UIAlertAction actionWithTitle:@"Reload" 200 addAction:[UIAlertAction actionWithTitle:@"Reload"
201 style:UIAlertActionStyleDefault 201 style:UIAlertActionStyleDefault
202 handler:^(UIAlertAction* action) { 202 handler:^(UIAlertAction* action) {
203 [_webView reload]; 203 [_webView reload];
204 }]]; 204 }]];
205 205
206 // Removes the web view from the view hierarchy and deallocates it. For
207 // testing deallocation behavior, because there have been multiple crash bugs
208 // on deallocation of CWVWebView.
209 [alertController
210 addAction:[UIAlertAction actionWithTitle:@"Deallocate web view"
211 style:UIAlertActionStyleDefault
212 handler:^(UIAlertAction* action) {
213 [_webView removeFromSuperview];
214 _webView = nil;
215 }]];
216
206 [self presentViewController:alertController animated:YES completion:nil]; 217 [self presentViewController:alertController animated:YES completion:nil];
207 } 218 }
208 219
209 - (BOOL)textFieldShouldReturn:(UITextField*)field { 220 - (BOOL)textFieldShouldReturn:(UITextField*)field {
210 NSURLRequest* request = 221 NSURLRequest* request =
211 [NSURLRequest requestWithURL:[NSURL URLWithString:[field text]]]; 222 [NSURLRequest requestWithURL:[NSURL URLWithString:[field text]]];
212 [_webView loadRequest:request]; 223 [_webView loadRequest:request];
213 [field resignFirstResponder]; 224 [field resignFirstResponder];
214 [self updateToolbar]; 225 [self updateToolbar];
215 return YES; 226 return YES;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // TODO(crbug.com/679895): Add some visual indication that the page load has 389 // TODO(crbug.com/679895): Add some visual indication that the page load has
379 // finished. 390 // finished.
380 [self updateToolbar]; 391 [self updateToolbar];
381 } 392 }
382 393
383 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView { 394 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView {
384 NSLog(@"webViewWebContentProcessDidTerminate"); 395 NSLog(@"webViewWebContentProcessDidTerminate");
385 } 396 }
386 397
387 @end 398 @end
OLDNEW
« no previous file with comments | « ios/web_view/internal/cwv_scroll_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698