Prevent V8 from deleting BatteryManager when listeners are attached.

Add a hasPendingActivity() event to prevent the BatteryManager V8
object from being garbage collected when event listeners are attached.
This is required when no reference to the battery is explicitly stored
in the script, as illustrated by the included layout test.

BUG=

Review URL: https://codereview.chromium.org/432853002

git-svn-id: svn://svn.chromium.org/blink/trunk@179450 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Remove mocking from DataObjectTest.cpp

This must land after the CL that adds WebBlobRegistry mocking to the
Platform used by blink unit tests.
CL: https://codereview.chromium.org/434833002

This change takes advantage of the CL above to remove the Platform
mocking from the DataObject unit test.

BUG=398366

Review URL: https://codereview.chromium.org/434823002

git-svn-id: svn://svn.chromium.org/blink/trunk@179451 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Use WorkerThreadTask for timer and idle notification in WorkerThread.

The shared timer and idle notification tasks don't need to execute once the stop() method has been called. This change ensures that by wrapping them up in WorkerThreadTask.
Also, the WorkerThreadTask::run method wasn't checking for valid WorkerGlobalScope. It is possible for a task to be posted to the message loop after the cleanup is posted, which results in a crash.

BUG=301515,399495

Review URL: https://codereview.chromium.org/430813007

git-svn-id: svn://svn.chromium.org/blink/trunk@179453 bbb929c8-8fbe-4397-9dbb-9b2b20218538