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

Side by Side Diff: third_party/WebKit/Source/modules/geolocation/Geolocation.cpp

Issue 2049003002: Wrap GCed raw pointer parameters of WTF::bind with Persistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. 3 * Copyright (C) 2009 Torch Mobile, Inc.
4 * Copyright 2010, The Android Open Source Project 4 * Copyright 2010, The Android Open Source Project
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 m_geolocationPermission = PermissionRequested; 423 m_geolocationPermission = PermissionRequested;
424 frame->serviceRegistry()->connectToRemoteService( 424 frame->serviceRegistry()->connectToRemoteService(
425 mojo::GetProxy(&m_permissionService)); 425 mojo::GetProxy(&m_permissionService));
426 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t his)))); 426 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t his))));
427 427
428 // Ask the embedder: it maintains the geolocation challenge policy itself. 428 // Ask the embedder: it maintains the geolocation challenge policy itself.
429 m_permissionService->RequestPermission( 429 m_permissionService->RequestPermission(
430 mojom::blink::PermissionName::GEOLOCATION, 430 mojom::blink::PermissionName::GEOLOCATION,
431 getExecutionContext()->getSecurityOrigin()->toString(), 431 getExecutionContext()->getSecurityOrigin()->toString(),
432 UserGestureIndicator::processingUserGesture(), 432 UserGestureIndicator::processingUserGesture(),
433 createBaseCallback(bind(&Geolocation::onGeolocationPermissionUpdated, th is))); 433 createBaseCallback(bind(&Geolocation::onGeolocationPermissionUpdated, wr apPersistent(this))));
434 } 434 }
435 435
436 void Geolocation::makeSuccessCallbacks() 436 void Geolocation::makeSuccessCallbacks()
437 { 437 {
438 DCHECK(m_lastPosition); 438 DCHECK(m_lastPosition);
439 DCHECK(isAllowed()); 439 DCHECK(isAllowed());
440 440
441 GeoNotifierVector oneShotsCopy; 441 GeoNotifierVector oneShotsCopy;
442 copyToVector(m_oneShots, oneShotsCopy); 442 copyToVector(m_oneShots, oneShotsCopy);
443 443
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 496
497 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca tionService)); 497 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca tionService));
498 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G eolocation::onGeolocationConnectionError, WeakPersistentThisPointer<Geolocation> (this)))); 498 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G eolocation::onGeolocationConnectionError, WeakPersistentThisPointer<Geolocation> (this))));
499 if (m_enableHighAccuracy) 499 if (m_enableHighAccuracy)
500 m_geolocationService->SetHighAccuracy(true); 500 m_geolocationService->SetHighAccuracy(true);
501 queryNextPosition(); 501 queryNextPosition();
502 } 502 }
503 503
504 void Geolocation::queryNextPosition() 504 void Geolocation::queryNextPosition()
505 { 505 {
506 m_geolocationService->QueryNextPosition(createBaseCallback(bind(&Geolocation ::onPositionUpdated, this))); 506 m_geolocationService->QueryNextPosition(createBaseCallback(bind(&Geolocation ::onPositionUpdated, wrapPersistent(this))));
507 } 507 }
508 508
509 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) 509 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position)
510 { 510 {
511 m_disconnectedGeolocationService = false; 511 m_disconnectedGeolocationService = false;
512 if (position->valid) { 512 if (position->valid) {
513 m_lastPosition = createGeoposition(*position); 513 m_lastPosition = createGeoposition(*position);
514 positionChanged(); 514 positionChanged();
515 } else { 515 } else {
516 handleError(createPositionError(position->error_code, position->error_me ssage)); 516 handleError(createPositionError(position->error_code, position->error_me ssage));
(...skipping 13 matching lines...) Expand all
530 error->setIsFatal(true); 530 error->setIsFatal(true);
531 handleError(error); 531 handleError(error);
532 } 532 }
533 533
534 void Geolocation::onPermissionConnectionError() 534 void Geolocation::onPermissionConnectionError()
535 { 535 {
536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED);
537 } 537 }
538 538
539 } // namespace blink 539 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698