<commit_before>#include "atom_cef_render_process_handler.h"
#import "native/v8_extensions/atom.h"
#import "native/v8_extensions/native.h"
#import "native/v8_extensions/onig_reg_exp.h"
#include <iostream>

void AtomCefRenderProcessHandler::OnWebKitInitialized() {
  new v8_extensions::Atom();
  new v8_extensions::Native();
  new v8_extensions::OnigRegExp();
}

void AtomCefRenderProcessHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
                                     CefRefPtr<CefFrame> frame,
                                     CefRefPtr<CefV8Context> context) {
#ifdef RESOURCE_PATH
  CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString(RESOURCE_PATH);
#else
  CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString([[[NSBundle mainBundle] resourcePath] UTF8String]);
#endif

  CefRefPtr<CefV8Value> global = context->GetGlobal();
  CefRefPtr<CefV8Value> atom = global->GetValue("atom");
  atom->SetValue("resourcePath", resourcePath, V8_PROPERTY_ATTRIBUTE_NONE);
}

bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
                                          CefProcessId source_process,
                                          CefRefPtr<CefProcessMessage> message) {
  if (message->GetName().ToString() == "reload") {
    Reload(browser);
  }

  return true;
}

void AtomCefRenderProcessHandler::Reload(CefRefPtr<CefBrowser> browser) {
  CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context();
  CefRefPtr<CefV8Value> global = context->GetGlobal();

  context->Enter();
  CefV8ValueList arguments;

  CefRefPtr<CefV8Value> reloadFunction = global->GetValue("reload");
//  reloadFunction->ExecuteFunction(global, arguments);
//  if (reloadFunction->HasException()) {
    browser->ReloadIgnoreCache();
//  }
  context->Exit();
}<commit_msg>Display prompt (still un-retina-fied) when reloading w/ unsaved buffers<commit_after>#include "atom_cef_render_process_handler.h"
#import "native/v8_extensions/atom.h"
#import "native/v8_extensions/native.h"
#import "native/v8_extensions/onig_reg_exp.h"
#include <iostream>

void AtomCefRenderProcessHandler::OnWebKitInitialized() {
  new v8_extensions::Atom();
  new v8_extensions::Native();
  new v8_extensions::OnigRegExp();
}

void AtomCefRenderProcessHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
                                     CefRefPtr<CefFrame> frame,
                                     CefRefPtr<CefV8Context> context) {
#ifdef RESOURCE_PATH
  CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString(RESOURCE_PATH);
#else
  CefRefPtr<CefV8Value> resourcePath = CefV8Value::CreateString([[[NSBundle mainBundle] resourcePath] UTF8String]);
#endif

  CefRefPtr<CefV8Value> global = context->GetGlobal();
  CefRefPtr<CefV8Value> atom = global->GetValue("atom");
  atom->SetValue("resourcePath", resourcePath, V8_PROPERTY_ATTRIBUTE_NONE);
}

bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
                                          CefProcessId source_process,
                                          CefRefPtr<CefProcessMessage> message) {
  if (message->GetName().ToString() == "reload") {
    Reload(browser);
  }

  return true;
}

void AtomCefRenderProcessHandler::Reload(CefRefPtr<CefBrowser> browser) {
  CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context();
  CefRefPtr<CefV8Value> global = context->GetGlobal();

  context->Enter();
  CefV8ValueList arguments;

  CefRefPtr<CefV8Value> reloadFunction = global->GetValue("reload");
  reloadFunction->ExecuteFunction(global, arguments);
  if (reloadFunction->HasException()) {
    browser->ReloadIgnoreCache();
  }
  context->Exit();
}
{'fraction_non_alphanumeric': 0.11801075268817204, 'fraction_numerical': 0.010752688172043012, 'mean_word_length': 4.361671469740634, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948071', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1179, 'n_words': 170}