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

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: revert "unretained" part and "disallow pointers" part 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 m_geolocationPermission = PermissionRequested; 422 m_geolocationPermission = PermissionRequested;
423 frame->serviceRegistry()->connectToRemoteService( 423 frame->serviceRegistry()->connectToRemoteService(
424 mojo::GetProxy(&m_permissionService)); 424 mojo::GetProxy(&m_permissionService));
425 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t his)))); 425 m_permissionService.set_connection_error_handler(createBaseCallback(bind(&Ge olocation::onPermissionConnectionError, WeakPersistentThisPointer<Geolocation>(t his))));
426 426
427 // Ask the embedder: it maintains the geolocation challenge policy itself. 427 // Ask the embedder: it maintains the geolocation challenge policy itself.
428 m_permissionService->RequestPermission( 428 m_permissionService->RequestPermission(
429 mojom::blink::PermissionName::GEOLOCATION, 429 mojom::blink::PermissionName::GEOLOCATION,
430 getExecutionContext()->getSecurityOrigin()->toString(), 430 getExecutionContext()->getSecurityOrigin()->toString(),
431 createBaseCallback(bind<mojom::blink::PermissionStatus>(&Geolocation::on GeolocationPermissionUpdated, this))); 431 createBaseCallback(bind<mojom::blink::PermissionStatus>(&Geolocation::on GeolocationPermissionUpdated, wrapCrossThreadPersistent(this))));
432 } 432 }
433 433
434 void Geolocation::makeSuccessCallbacks() 434 void Geolocation::makeSuccessCallbacks()
435 { 435 {
436 DCHECK(m_lastPosition); 436 DCHECK(m_lastPosition);
437 DCHECK(isAllowed()); 437 DCHECK(isAllowed());
438 438
439 GeoNotifierVector oneShotsCopy; 439 GeoNotifierVector oneShotsCopy;
440 copyToVector(m_oneShots, oneShotsCopy); 440 copyToVector(m_oneShots, oneShotsCopy);
441 441
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca tionService)); 495 frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_geoloca tionService));
496 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G eolocation::onGeolocationConnectionError, WeakPersistentThisPointer<Geolocation> (this)))); 496 m_geolocationService.set_connection_error_handler(createBaseCallback(bind(&G eolocation::onGeolocationConnectionError, WeakPersistentThisPointer<Geolocation> (this))));
497 if (m_enableHighAccuracy) 497 if (m_enableHighAccuracy)
498 m_geolocationService->SetHighAccuracy(true); 498 m_geolocationService->SetHighAccuracy(true);
499 queryNextPosition(); 499 queryNextPosition();
500 } 500 }
501 501
502 void Geolocation::queryNextPosition() 502 void Geolocation::queryNextPosition()
503 { 503 {
504 m_geolocationService->QueryNextPosition(createBaseCallback(bind<mojom::blink ::GeopositionPtr>(&Geolocation::onPositionUpdated, this))); 504 m_geolocationService->QueryNextPosition(createBaseCallback(bind<mojom::blink ::GeopositionPtr>(&Geolocation::onPositionUpdated, wrapCrossThreadPersistent(thi s))));
505 } 505 }
506 506
507 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position) 507 void Geolocation::onPositionUpdated(mojom::blink::GeopositionPtr position)
508 { 508 {
509 m_disconnectedGeolocationService = false; 509 m_disconnectedGeolocationService = false;
510 if (position->valid) { 510 if (position->valid) {
511 m_lastPosition = createGeoposition(*position); 511 m_lastPosition = createGeoposition(*position);
512 positionChanged(); 512 positionChanged();
513 } else { 513 } else {
514 handleError(createPositionError(position->error_code, position->error_me ssage)); 514 handleError(createPositionError(position->error_code, position->error_me ssage));
(...skipping 13 matching lines...) Expand all
528 error->setIsFatal(true); 528 error->setIsFatal(true);
529 handleError(error); 529 handleError(error);
530 } 530 }
531 531
532 void Geolocation::onPermissionConnectionError() 532 void Geolocation::onPermissionConnectionError()
533 { 533 {
534 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); 534 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED);
535 } 535 }
536 536
537 } // namespace blink 537 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698